Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("apis/tortoise.lua")
- local id,x,z = ...
- id = tonumber(id)
- x = tonumber(x)
- z = tonumber(z)
- local function digRow(l, d)
- if d==1 then
- tortoise.forceForward(l)
- else
- tortoise.forceBack(l)
- end
- end
- local position = {}
- position.x = 0
- position.y = 0
- position.z = 0
- tortoise.forceForward()
- tortoise.forceDown()
- position.y=1
- if id==2 then
- tortoise.turnRight()
- tortoise.forceForward(z/2)
- tortoise.turnLeft()
- tortoise.forceDown(1)
- position.x = 1
- position.z = z/2
- elseif id==3 then
- tortoise.forceForward((x/2) - 1)
- tortoise.forceDown(2)
- position.x = x/2
- position.z = 1
- elseif id==4 then
- tortoise.forceForward((x/2) - 1)
- tortoise.turnRight()
- tortoise.forceForward(z/2)
- tortoise.turnLeft()
- tortoise.forceDown(3)
- position.x = x/2
- position.z = z/2
- end
- local function returnHome()
- print(position.x)
- print(position.y)
- print(position.z)
- tortoise.forceUp(position.y)
- tortoise.forceForward(position.z)
- tortoise.turnRight()
- tortoise.forceForward(position.x)
- end
- while true do
- for i=1,(x/2) do
- digRow((z/2)-1, 1)
- if i%2==1 then position.z = position.z + (z/2)
- else position.z = position.z - (z/2) end
- if (i)%2==1 then tortoise.turnRight()
- else tortoise.turnLeft() end
- if not(i == x/2) then
- tortoise.forceForward()
- else position.x = position.x + 1 end
- if (i)%2==1 then tortoise.turnRight()
- else tortoise.turnLeft() end
- end
- tortoise.forceDown()
- position.y = position.y + 1
- returnHome()
- return
- end
Advertisement
Add Comment
Please, Sign In to add comment