Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num_const=0
- num=0
- depth_const=2
- length_const=16
- width_const=5
- halflength=0
- level=18
- depth=0
- width=0
- length=0
- temp=0
- function EVEN_ODD()
- temp=length_const
- if temp%2==1 then
- length_const=length_const-1
- halflength_const=length_const/2
- else
- halflength_const=length_const/2
- end
- end
- function MOVE_FORWARD(slot)
- turtle.select(slot)
- while not turtle.forward() do
- turtle.attack()
- turtle.dig()
- end
- if turtle.getItemSpace(slot)>30 then
- turtle.placeDown()
- return(slot-1)
- else
- turtle.placeDown()
- return(slot)
- end
- end
- function ONE_LINE(sslot)
- while width ~= width_const do
- sslot=MOVE_FORWARD(sslot)
- sslot=sslot+1
- width=width+1
- end
- width=0
- return(sslot)
- end
- function RIGHT()
- turtle.turnRight()
- sslot=MOVE_FORWARD(sslot)
- turtle.turnRight()
- end
- function LEFT()
- turtle.turnLeft()
- sslot=MOVE_FORWARD(sslot)
- turtle.turnLeft()
- end
- function ONE_LAYER()
- sslot=1
- while length ~= length_const do
- sslot=MOVE_FORWARD(sslot)
- sslot=sslot+1
- length=length+1
- end
- turtle.turnLeft()
- while halflength ~= halflength_const do
- sslot=ONE_LINE(sslot)
- LEFT()
- sslot=ONE_LINE(sslot)
- RIGHT()
- halflength=halflength+1
- end
- length=0
- halflength=0
- turtle.turnRight()
- end
- function UP()
- while not turtle.up() do
- turtle.attackUp()
- end
- end
- function DOWN()
- while not turtle.down() do
- turtle.attackDown()
- turtle.digDown()
- end
- end
- function TURN()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function DROP_ALL()
- space=1
- while space<17 do
- turtle.select(space)
- turtle.drop()
- space=space+1
- end
- end
- function GET_TO_START()
- num=0
- turtle.turnLeft()
- while num ~= num_const do
- if level == 0 then
- while not turtle.forward() do
- turtle.attack()
- turtle.dig()
- end
- else
- while not turtle.forward() do
- sleep(1)
- end
- end
- num=num+1
- end
- turtle.turnRight()
- depth=level
- while depth~=0 do
- DOWN()
- depth=depth-1
- end
- end
- function RETURN_AND_REFUEL()
- depth=0
- temp=level
- while depth ~= temp do
- UP()
- depth=depth+1
- end
- while not turtle.up() do
- sleep(1)
- end
- if num_const~=0 then
- while not turtle.up() do
- sleep(1)
- end
- end
- turtle.turnRight()
- while num ~= 0 do
- while not turtle.forward() do
- sleep(1)
- end
- num=num-1
- end
- if num_const ~= 0 then
- while not turtle.down() do
- sleep(1)
- end
- end
- if turtle.getFuelLevel()<1000 then
- turtle.turnRight()
- turtle.suck()
- turtle.refuel()
- TURN()
- else
- turtle.turnLeft()
- end
- while not turtle.down() do
- sleep(1)
- end
- GET_TO_START()
- level = level+1
- end
- function START()
- --print("enter width")
- --width_const=tonumber(read())
- --if width_const<=1 then
- -- width_const=2
- -- print("width can't be less then 2. Now it is 2.")
- --end
- print("enter depth")
- depth_const=tonumber(read())
- print("enter turt number")
- num_const=tonumber(read())
- num_const=num_const*11
- print("enter level")
- level=tonumber(read())
- if turtle.getFuelLevel() <1000 then
- TURN()
- turtle.suck()
- turtle.refuel()
- TURN()
- end
- end
- START()
- EVEN_ODD()
- DOWN()
- GET_TO_START()
- --depth_const = level+depth_const
- while level~=depth_const do
- ONE_LAYER()
- RETURN_AND_REFUEL()
- end
Add Comment
Please, Sign In to add comment