Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function moveAround()
- turtle.turnRight()
- if turtle.forward() then
- moveRight()
- else
- turtle.turnLeft()
- moveLeft()
- end
- end
- function moveRight()
- turtle.turnRight()
- if turtle.forward() then
- if turtle.forward() then
- turtle.turnLeft()
- if turtle.forward() then
- turtle.turnRight()
- print("I moved around the tree.")
- move()
- else
- print("Couldn't go right, trying left...")
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- moveLeft()
- end
- else
- print("Couldn't go right, trying left...")
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- moveLeft()
- end
- else
- print("Couldn't go right, trying left...")
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- moveLeft()
- end
- end
- function moveLeft()
- turtle.turnLeft()
- if turtle.forward() then
- turtle.turnRight()
- if turtle.forward() then
- if turtle.forward() then
- turtle.turnRight()
- if turtle.forward() then
- turtle.turnLeft()
- print("I moved around the tree.")
- move()
- else
- print("I'm seriously stuck, master...")
- end
- else
- print("I'm seriously stuck, master...")
- end
- else
- print("I'm seriously stuck, master...")
- end
- else
- print("I'm seriously stuck, master...")
- end
- end
- moveAround()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement