-- Function to select a slot with blocks
function selectBlock()
for i = 1, 16 do
if turtle.getItemCount(i) > 0 then
turtle.select(i)
return true
end
end
return false
end
-- Fill platform of given width and length
function fillPlatform(width, length)
local turnRight = true
for row = 1, length do
for col = 1, width do
if not selectBlock() then
print("Out of blocks!")
return
end
turtle.placeDown()
if col < width then
turtle.forward()
end
end
if row < length then
if turnRight then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
turnRight = not turnRight
end
end
end
-- Replace these with desired dimensions
local width = 5
local length = 4
-- Start the filling
fillPlatform(width, length)
Comments
0 B
|0 👍
/0 👎
0 B
|👍
/👎