Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local xSize = 10
- local ySize = 10
- local xPos = 0
- local yPos = 0
- local zPos = 0
- local minFuel = 20
- local forward = true
- function refuel()
- if turtle.getFuelLevel() < minFuel then
- turtle.select(16)
- turtle.refuel()
- end
- end
- function move()
- if turtle.detect() then
- return false
- end
- turtle.forward()
- if forward then
- yPos = yPos + 1
- if yPos > ySize then
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- xPos = xPos + 1
- forward = not forward
- end
- else
- yPos = yPos - 1
- if yPos <= 0 then
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- xPos = xPos + 1
- foward = not forward
- end
- end
- if xPos > xSize then
- if yPos == 0 then
- turtle.turnLeft()
- else
- while yPos > 0 do
- turtle.forward()
- yPos = yPos - 1
- end
- end
- while xPos > 0 do
- turtle.forward()
- turtle.forward()
- xPos = xPos - 1
- end
- end
- end
- function dig()
- turtle.dig()
- end
- while true do
- refuel()
- print(move())
- dig()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement