Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --args(depth, stepsX, stepsY, startDir, freshStart)
- args = {...}
- local numz = tonumber(args[1]) or 5
- local numx = tonumber(args[2]) or 1
- local numy = tonumber(args[3]) or numy
- local mon = peripheral.wrap("top")
- dir = dir or nil
- --initial move dir (-1 == left) (1 == right)
- dir = tonumber(args[4]) or -1 --initial move dir
- local fresh = args[5] == "true" and true or false
- local ydir = "f" --row step dir
- local sizex, sizey = 5, 5
- local lastmove = ydir
- local ddep = 27
- function deploy(a1,a2,a3)
- shell.run("deploy",a1,a2,a3)
- end
- function printPos(x,y,z)
- mon.clearLine()
- local cx, cy = mon.getCursorPos()
- mon.setCursorPos(1,cy)
- mon.write(tostring(x)..","..tostring(y)..","..tostring(z).." of "..tostring(numx)..","..tostring(numy)..","..tostring(numz))
- end
- --deploy("r")
- for y=1,numy do
- for x=1,numx-1 do
- for z=1,numz do
- shell.run("dig")
- --when past threshold deploy
- if z>ddep then
- sleep(.2)
- --deploy logic
- if (y == 1)(
- if fresh then
- if elseif lastmove == "l" then
- deploy(ydir,"l","b")
- elseif lastmove == "r" then
- deploy(ydir,"r","b")
- else lastmove == ydir then
- deploy() -- all sides
- end
- else
- if lastmove == ydir then deploy(ydir,"l","r")
- elseif lastmove == "l" then deploy(ydir,"l")
- elseif lastmove == "r" then deploy(ydir,"r")
- else deploy()
- end
- end
- shell.run("move","ad","1")
- printPos(x,y,z) --update display every movement
- end --z
- --retract
- shell.run("move","au",tostring(numz))
- end --x
- if dir>0 then lastmove = "r" else lastmove = "l" end
- shell.run("move",lastmove,sizey)
- fresh = false
- dir = -dir
- lastmove = ydir
- shell.run("move",lastmove,sizex)
- print()
- end --y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement