This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Razputin's profile picture

Wheat Autoharvester Turtle

Started by Razputin, 13 February 2013 - 01:28 PM
Razputin #1
Posted 13 February 2013 - 02:28 PM
Look upon my works, ye Mighty, and despair!
I made a planting turtle that works well with a water autoharvester. Feel free to steal and improve upon my design.
I'm also looking for feedback on my code how to make it more condensed and less line heavy.

Tray = 6x7 farm plot.
Every following tray is one Y level lower to allow water to flow down and allow the produce to flow to the bottom and be collected by obsidian pipes.

Video:
http://www.youtube.com/watch?v=f4Yeb3ZCRj8&feature=youtu.be


Code:
http://pastebin.com/nceskdB0

Note: Turtle.select is for each tray since it takes 42 seeds to plant and 64 in one stack isn't enough for two trays.
kk258966 #2
Posted 15 February 2013 - 06:24 PM
Look upon my works, ye Mighty, and despair!
I made a planting turtle that works well with a water autoharvester. Feel free to steal and improve upon my design.
I'm also looking for feedback on my code how to make it more condensed and less line heavy.


Tray = 6x7 farm plot.
Every following tray is one Y level lower to allow water to flow down and allow the produce to flow to the bottom and be collected by obsidian pipes.


--[Code for the turtle to leave start position and go to farming level]--
function start()
turtle.forward()
turtle.down()
turtle.down()
end

--[Multiple move commands]--
function m7()
m()
m()
m()
m()
m()
m()
m()
end

--[Down Command]--
function d()
turtle.down()
end

--[Code for the turtle to return toward start position]--
function re()
m7()
turtle.up()
end

--[Planting code]--
function p()
turtle.digDown()
turtle.placeDown()
end

--[Code for returning turn depending on the 'tray' you end on. Odd/even]--
function rlt()
turtle.turnLeft()
turtle.up()
turtle.up()
end

--[Ditto]--
function rrt()
turtle.turnRight()
turtle.up()
turtle.up()
end

--[For turning at the end of each row of plots. Odd/even]--
function lt()
turtle.turnLeft()
turtle.forward()
turtle.turtle.Left()
end

--[Ditto]--
function rt()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
end

--[Function for each row of plots]--
function row()
p()
m()
p()
m()
p()
m()
p()
m()
p()
m()
p()
end

--['Tray' odd.]--
function to()
row()
rt()
row()
lt()
row()
rt()
row()
lt()
row()
rt()
row()
lt()
row()
rt()
d()
end

--['Tray' even]--
function te()
row()
lt()
row()
rt()
row()
lt()
row()
rt()
row()
lt()
row()
rt()
row()
lt()
d()
end

--[Start of the executable part of program]--
start()
to()
turtle.select(2)
te()
turtle.select(3)
to()
turtle.select(4)
te()
turtle.select(1)
rlt()
re()
re()
re()
m7()
turtle.turnRight()
turtle.back()
turtle.up()
turtle.up()
turtle.back()


Turtle.select is for each tray since it takes 42 seeds to plant and 64 in one stack isn't enough for two trays.
IT would be better if you put some pictures or a video on
superaxander #3
Posted 15 February 2013 - 09:55 PM
spoil or put the code on pastebin
Razputin #4
Posted 18 February 2013 - 10:28 AM
spoil or put the code on pastebin
Sorry, this is my first time posting content. I've made the necessary changes.
Pugnacious #5
Posted 27 September 2013 - 03:00 PM
I had reason to use this same type of system this week. My wife loves farming, but she hates doing massive farms by herself. I found some bugs in your code and fixed it for you in the process of setting my own farm up.

Here you go:

http://pastebin.com/LYg9Tad0
kreezxil #6
Posted 06 October 2013 - 01:24 PM
I had reason to use this same type of system this week. My wife loves farming, but she hates doing massive farms by herself. I found some bugs in your code and fixed it for you in the process of setting my own farm up.

Here you go:

http://pastebin.com/LYg9Tad0

I took this a step a further and made the code readable and merged the two movement functions together into a more universal function.

Spoiler
-- Wheat farming turtle by Razputin
-- Modified and bugfixed by Pugnacious
-- Optimized and cleaned up by Kreezxil 10/6/2013

--[Code for the turtle to leave start position and go to farming level]--
function start()
   turtle.forward()
   turtle.down()
   turtle.down()
end

-- rewrote this function to be extensible and to eliminate the m7
function move(i)
   for j=1,i do
      turtle.forward()
   end
end

--[Down Command]--
function down()
   turtle.down()
end

--[Code for the turtle to return toward start position]--
function returnTurtle()
   move(7)
   turtle.up()
end

--[Planting code]--
function plant()
   turtle.digDown()
   turtle.placeDown()
end

--[Code for returning turn depending on the 'tray' you end on. Odd/even]--
function returningLeftTurn()
   turtle.turnLeft()
   turtle.up()
   turtle.up()
end

--[Ditto]--
function returningRightTurn()
   turtle.turnRight()
   turtle.up()
   turtle.up()
end

--[For turning at the end of each row of plots. Odd/even]--
function leftTurn()
   turtle.turnLeft()
   turtle.forward()
   turtle.turnLeft()
end

--[Ditto]--
function rightTurn()
   turtle.turnRight()
   turtle.forward()
   turtle.turnRight()
end

--[Function for each row of plots]--
function row()
   for i=1,5 do
      plant()
      move()
   end
   plant()
end


--['Tray' -the body.]--
-- by kreezxil to make trayOdd() and trayEven() more readable

function trayBody()
   turtle.refuel()

   for i=1,3 do
      row()
      rightTurn()
      row()
      leftTurn()
   end

end

--['Tray' odd.]--
-- Added a refuel for those of us who require fuel

function trayOdd()
   trayBody()
   row()
   rightTurn()
  down()
end

--['Tray' even]--
-- Added a refuel for those of us who require fuel

function trayEven()
   trayBody()
   row()
   leftTurn()
  down()
end

--[Start of the executable part of program]--
-- Added refuel and set the order of inventory selections.
-- Inventory box 1 is for fuel and the rest is for seeds.

turtle.refuel()
start()
turtle.select (2)
trayOdd()
turtle.select(3)
trayEven()
turtle.select(4)
trayOdd()
turtle.select(5)
trayEven()
returningLeftTurn()
returnTurtle()
returnTurtle()
returnTurtle()
move(7)
turtle.turnRight()
turtle.back()
turtle.up()
turtle.up()
turtle.back()
http://pastebin.com/kn11xVBM
Pastebin Code: kn11xVBM