Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run('clear')
- args = {...}
- local length = tonumber(args[1])
- local width = tonumber(args[2])
- local dirIsForward = true
- for i = 0, width-1, 1 do
- for j = 0, length-1, 1 do
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- local yCount = 0
- while(turtle.detectUp()) do
- turtle.digUp()
- turtle.up()
- yCount = yCount + 1
- end
- while (yCount ~= 0) do
- turtle.down()
- yCount = yCount - 1
- end
- end
- if dirIsForward and j ~= width-1 then
- turtle.turnRight()
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- turtle.turnRight()
- elseif not dirIsForward and j ~= width-1 then
- turtle.turnLeft()
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- turtle.turnLeft()
- end
- dirIsForward = not dirIsForward
- end
Add Comment
Please, Sign In to add comment