Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local firstItem,lastItem = 2,16
- function lootAll()
- for i=firstItem,lastItem do
- turtle.select(i)
- turtle.suck()
- end
- end
- function placeAll()
- for i=firstItem,lastItem do
- turtle.select(i)
- turtle.drop()
- end
- end
- function turnAround()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function walk(x)
- for i=1,x do
- turtle.forward()
- end
- end
- function walkUntilObstructed()
- local walking = true
- local walked = 0
- while walking do
- if turtle.detect() then
- walking = false
- else
- walked = walked + 1
- turtle.forward()
- end
- end
- return walked
- end
- local initialFuel = turtle.getFuelLevel()
- lootAll()
- turnAround()
- walkUntilObstructed()
- placeAll()
- turnAround()
- walkUntilObstructed()
- local finalFuel = turtle.getFuelLevel()
- print("Used Fuel:", initialFuel - finalFuel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement