Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- find out how long
- write("Put torches in slot 16. That's the bottom row , right corner. \n")
- write("Put as much fuel as you think you'll need in the other slots starting with #1. \n")
- write("How long should I make it? \n ")
- local length = tonumber( read() )
- -- find out how many branches to make
- write("How many halls? ")
- local halls = tonumber(read())
- local fuel=1
- local x,y,z=0,0,0
- function turnaround()
- turtle.turnRight()
- turtle.turnRight()
- end
- function placemarker()
- turtle.select(16)
- turtle.placeDown()
- end
- function refuel()
- --print("My fuel level is "..turtle.getItemCount(fuel))
- if turtle.getItemCount(fuel) == 0 then
- fuel=fuel+1
- else
- end
- if turtle.getFuelLevel() < 21 then
- print("my fuel is "..turtle.getFuelLevel())
- turtle.select(fuel)
- turtle.refuel(1)
- end
- end
- function run()
- if not turtle.forward() then
- repeat
- refuel()
- turtle.dig()
- sleep(0.25)
- until turtle.forward()
- end
- end
- function moveover()
- turtle.turnLeft()
- for m=1,3 do
- run()
- z=z+1
- print("Z while moving = "..z)
- turtle.digDown()
- end
- turtle.down()
- turtle.turnLeft()
- end
- function aBranch()
- for d=1,length do
- run()
- end
- turtle.digUp()
- turtle.up()
- turnaround()
- placemarker()
- for d=1,length do
- run()
- end
- placemarker()
- end
- --[[
- program starts here
- if the program turns too soon or too late,
- change i=< halls to i=halls or i<halls
- ]]
- refuel()
- for i=1, halls do
- print("i start of loop = "..i)
- print("Z start of loop = "..z)
- aBranch()
- if z<=((halls*3)-6) then -- z counts spaces to the left of starting.
- moveover()
- else
- end
- end
- turtle.turnRight()
- for rt=1,z do
- run()
- end
- turtle.turnLeft()
- print("I am finished")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement