function selSlot()
  for i = 1,16,1 do
    if turtle.getItemCount(i) > 0 then
      turtle.select(i)
      return true
    end
  end
  exit()
end

for x=1,64,1 do
  for z=1,64,1 do
    selSlot()
    turtle.placeUp()
    if not turtle.forward() then
      exit()
    end
  end
  selSlot()
  turtle.placeUp()
  if x % 2 == 0 then
    turtle.turnLeft()
  else
    turtle.turnRight()
  end
  if not turtle.forward() then
    exit()
  end
  if x % 2 == 0 then
    turtle.turnLeft()
  else
    turtle.turnRight()
  end
end
turtle.up()
turtle.up()
turtle.turnRight()
turtle.forward()
