Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local w = args[1] or 3
- local h = args[2] or 3
- function fuel()
- turtle.refuel()
- if not turtle.getFuelLevel() == 0 then
- print("Out of fuel")
- return false
- end
- return true
- end
- function square()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- for i = 1, h-1 do
- for _ = 1, w-1 do
- turtle.dig()
- turtle.forward()
- end
- if i < h-1 then
- turtle.digDown()
- turtle.down()
- for _ = 1, 2 do
- turtle.turnLeft()
- end
- end
- end
- end
- function move()
- while true do
- square()
- if h % 2 == 1 then
- for _ = 1, 2 do
- turtle.turnLeft()
- end
- for _ = 1, w-1 do
- turtle.forward()
- end
- end
- turtle.turnRight()
- for _ = 1, h-2 do
- turtle.up()
- end
- end
- end
- if fuel() then
- move()
- end
Advertisement
Add Comment
Please, Sign In to add comment