floorSize = 5 currentSlot = 2 function PlaceTorch() turtle.select(1) turtle.turnRight() turtle.turnRight() turtle.place() turtle.turnRight() turtle.turnRight() turtle.select(currentSlot) end function CheckSlotLevel() if (turtle.getItemCount() <= 0) then currentSlot = currentSlot + 1 turtle.select(currentSlot) end end function BuildRow(torch) for i=0,floorSize,1 do CheckSlotLevel() turtle.placeDown() if (torch and (i%5==0)) then PlaceTorch() end turtle.forward() end end function Turn(i) if (i%2==0) then turtle.turnRight() turtle.forward() turtle.turnRight() else turtle.turnLeft() turtle.forward() turtle.turnLeft() end end function Build() BuildRow(false) for i=0,floorSize,1 do Turn() torch = i%5==0 BuildRow(torch) end end turtle.select(currentSlot) Build()