Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Position = {}
- Orientation = 0
- function init()
- Position = {0, 0, 0}
- end
- function dig_front()
- if turtle.detect() then
- return turtle.dig()
- end
- end
- function dig_up()
- if turtle.detectUp() then
- return turtle.digUp()
- end
- end
- function dig_down()
- if turtle.detectDown() then
- return turtle.digDown()
- end
- end
- function forward()
- if turtle.forward() then
- if orientation == 0 then
- Position[0] = Position[0] + 1
- elseif orientation == 2 then
- Position[0] = Position[0] - 1
- elseif orientation == 3 then
- Position[1] = Position[1] + 1
- elseif orientation == 4 then
- Position[1] = Position[1] - 1
- end
- return true
- else
- return false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement