term.clear()
term.setCursorPos(1,1)
print("X90 Tree Farmer")
term.write("How many trees per row?")
doLenght = term.read()
term.write("How many rows?")
doWidth = term.read()
term.write("In what slot is your sapling?")
sapling = term.read()
term.write("In what slot is the dirt?")
dirt = term.read()
term.write("In what slot is the fuel?")
fuel = term.read()
term.write("Do you want to clear the area first before creating the farm?")
clearLand = term.read()
function goForward (times)
for i=1, times do
turtle.forward()
end
end
function xFarmTree ()
goForward(3)
if turtle.detect() then
turtle.dig()
end
turtle.forward()
if turtle.detectUp() then
while turtle.detectUp() do
turtle.digUp()
turtle.up()
end
while not turtle.compareDown(dirt) do
turtle.down()
if(turtle.detectDown() then
turtle.digDown()
end
end
turtle.up()
turtle.place(sapling)
end
end
function newRow (heading)
if heading == 1 then
turtle.turnLeft()
goForward(7)
turtle.turnLeft()
else
turtle.turnRight()
goForward(7)
turtle.turnRight()
end
end
function checkFuel ()
if turtle.getFuelLevel() < 20 then
print("Turtle is refueling")
print("New fuel level is: " + turtle.getFuelLevel())
turtle.refuel(fuel)
else
print("Turtle has a sufficient fuel level");
end
function turtleStart ()
checkFuel()
turtle.up()
end
function turtleShutD ()
turtle.down()
end
turtleStart()
heading=1
for i=1, doWidth do
for i=1, doLenght do
end
if heading/2 == 0 then
heading = 2
else
heading = 1
end
newRow(heading)
heading = heading+1
end
turtleShutD()