local robot = require("robot") local depth,width = ... if not depth or not width then print("Usage: farm ") return end print("Farming in a " .. depth .. "x" .. width .. " area") for _ = 1,width do -- break for _ = 1,depth do if robot.detectDown() then robot.swingDown() end while not robot.forward() do end end robot.turnAround() -- go back and place for _ = 1,depth do while not robot.forward() do end robot.placeDown() end -- advance to next row robot.turnRight() while not robot.forward() do end robot.turnRight() end -- go back to starting position robot.turnRight() for _ = 1,width do while not robot.forward() do end end robot.turnLeft()