currentSlot = 1
while(true)
  do
  turtle.select(currentSlot)
  turtle.placeDown()
  turtle.forward()
  turtle.down()
  if(turtle.detect())
    then
    turtle.turnLeft()
    end
  if(turtle.getFuelLevel() <= 0)
    then
    print("Refueling.")
    turtle.select(16)
    turtle.refuel(1)
    turtle.select(currentSlot)
    end
  if(turtle.getItemCount(currentSlot) <= 0)
    then
    currentSlot = currentSlot + 1
    turtle.select(currentSlot)
    end
  if(turtle.detectDown())
    then
    break
    end
  end
