Skip to content

Instantly share code, notes, and snippets.

@aviks
Created September 16, 2017 13:51
Show Gist options
  • Save aviks/266f4a52380f51fcc190c511dca9b088 to your computer and use it in GitHub Desktop.
Save aviks/266f4a52380f51fcc190c511dca9b088 to your computer and use it in GitHub Desktop.
using PiCraft
using SenseHat
using Colors
LED=led_matrix()
colors = Dict(
Block(12, 0)=>colorant"yellow",
Block(2, 0)=>colorant"green",
Block(9, 0)=>colorant"blue",
Block(0, 0)=>colorant"white"
)
const known_blocks = Dict()
function getBlocks()
x,y,z = player.getTile()
blocks=Array{Block, 1}()
y=y-1
for dz in (z-3):(z+4)
for dx in (x-3):(x+4)
b=(dx, y, dz)
block = get!(known_blocks, b, world.getBlock(dx, y, z))
push!(blocks, block)
end
end
return blocks
end
while true
map = reshape([get(colors, b, colorant"black",) for b in getBlocks()], 8,8)
map[4, 4] = colorant"black"
LED[:] = map
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment