Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = 0 --The amount turtle has moved by
- t = 0 --Left or right
- f = 0 --fuel amount
- z = 0 --Size of the square
- h = 0 --initial depth
- y = 0 --The depth it goes to
- cyclet = 0 --Use 1 and 2 or 3 and 4
- cycles = 0 --1 cycle = a row
- oto = 1 --One time only, initial code
- function init()
- if oto == 1 then
- f = turtle.getFuelLevel()
- if f == 0 then
- turtle.select(16)
- turtle.refuel(64)
- turtle.select(1)
- rednet.broadcast("Turtle is ready!")
- oto = 0
- end
- end
- end
- --function question()
- -- if oto == 1 then
- -- print("What size square are you hoping for?")
- -- z = tonumber(read())
- --end
- -- end
- function main()
- if x < 8 then
- while x < 8 do
- turtle.dig()
- turtle.forward()
- x = x + 1
- end
- end
- end
- function cycleCounter()
- if x == 8 then
- cycles = cycles + 1
- print(cycles)
- end
- end
- function turn()
- if x == 8 then
- if cyclet == 0 then
- if t == 0 then
- while x == z do
- print("turn one")
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- x = 0
- t = 1
- end
- end
- end
- end
- end
- function turnTwo()
- if x == 8 then
- if cyclet == 0 then
- if t == 1 then
- while x == z do
- print("turn two")
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- x = 0
- t = 0
- end
- end
- end
- end
- end
- function endCycle()
- if cycles == 8 then
- turtle.digDown()
- turtle.down()
- turtle.turnLeft()
- turtle.turnLeft()
- y = y - 1
- cycles = 0
- t = 0
- x = 0
- print("new cycle")
- if cyclet == 0 then
- cyclet = 1
- else
- cyclet = 0
- end
- end
- end
- function turnThree()
- if x == 8 then
- if cyclet == 1 then
- if t == 0 then
- while x == 8 do
- print("turn three")
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- x = 0
- t = 1
- end
- end
- end
- end
- end
- function turnFour()
- if x == 8 then
- if cyclet == 1 then
- if t == 1 then
- while x == z do
- print("turn four")
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- x = 0
- t = 0
- end
- end
- end
- end
- end
- while true do
- --question()
- init()
- main()
- cycleCounter()
- endCycle()
- turn()
- turnTwo()
- turnThree()
- turnFour()
- end
Advertisement
Add Comment
Please, Sign In to add comment