Untitled

                Never    
Lua
       
local robot = require("robot")

function up()
    local can, type = robot.detectUp()
    if (can)
    then
        robot.swingUp()
    end
    robot.up()
end

function forward()
    local can, type = robot.detect()
    if (can)
    then
        robot.swing()
    end
    robot.forward()
end

function placeDown()
    local can, type = robot.detectDown()
    if (can)
    then
        robot.swingDown()
    end
    robot.placeDown()
end

for slot = 1,16,1
do
    robot.select(slot)
    for i = 1,robot.count(slot),1
    do
        -- robot.up()
        forward()
        placeDown()
    end
    forward()
    robot.turnRight()
    up()
    robot.turnRight()
end

Raw Text