Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- -- Variables
- length = 6 --The length of the inner area of the arena, only even numbers.
- side = "right" --Leave this alone.
- rows = 3 --Use half the rows, can only handle whole numbers.
- -- Functions
- function start() -- Controlling the movement and places blocks.
- for i = 1,rows do
- spleef()
- move()
- navigateRight()
- spleef()
- move()
- navigateLeft()
- end
- end
- function home() -- Sends the turtle home, must be used after start() is done.
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.back()
- end
- function navigateRight() -- Handles the turtles navigation to the right.
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- end
- function navigateLeft() -- Handles the turtles navigation to the left.
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- function move() -- Places a block and then moves the turtle forward.
- for i = 1,length do
- spleef()
- turtle.forward()
- end
- end
- function spleef() -- Handles the placement of blocks.
- if turtle.detectUp() == false then
- turtle.forward()
- else
- randNum = math.random(1, 3)
- if randNum < 3 then
- turtle.digUp()
- else turtle.forward()
- end
- end
- end
- -- Code to be executed
- start()
Advertisement
Add Comment
Please, Sign In to add comment