Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local length, width, stop
- if (args[1] == nil) then
- print("Please give a size as the first argument.")
- length = 0
- width = 0
- else
- length = tonumber(args[1])
- if (args[2] ~= nil) then
- width = tonumber(args[2])
- else
- width = length
- end
- end
- local function forward()
- turtle.digUp()
- turtle.digDown()
- while (not turtle.forward()) do
- if (turtle.detect()) then
- turtle.dig()
- else
- turtle.attack()
- end
- end
- end
- local function turn(turnFunc)
- turnFunc()
- forward()
- turnFunc()
- end
- for i=1, width do
- for j=2, length do
- forward()
- end
- if (i < width) then
- if (i%2 == 1) then
- turn(turtle.turnRight)
- else
- turn(turtle.turnLeft)
- end
- end
- end
- turtle.digUp()
- turtle.digDown()
Advertisement
Add Comment
Please, Sign In to add comment