rdalkire / computercraft-programs

Some Lua scripts for the computercraft (minecraft mod) robot.
MIT License
2 stars 2 forks source link

With limited seed, crops bunched-up. #1

Closed rdalkire closed 10 years ago

rdalkire commented 10 years ago

Rows of crops are meant to be spaced apart or alternated, to promote faster growth, but in this case it didn't work out that way:

This was a regression defect that emerged at version 1.9.1, when the movement had been changed from forward-and-back to zigzag/bidirectional.

The test was in a field 14 blocks wide deliberately gave the turtle only about half a row's worth of wheat seeds, but then gave it plenty (way more than a row, like 20) carrots and potatoes. The result is in the attached image: The turtle starts at place '0' and plants its wheat until it runs out. At place '1' it switches to potatoes. Place '2' is where this problem becomes visible: It should have switched to carrots or at least left a gap, but instead it continued to plant potatoes. After place '3' it would have been okay to plant potatoes, but instead it left the gap. Basically the robot did the reverse of what it should have done. 2014-07-26_22 13 13

rdalkire commented 10 years ago

Logic error in function sowAndReapRow() at line 175. I had meant to find if the row index is even, but really this only evaluates to true when it's odd: if rowIdx % 2 then --Even

The correction was tested; it's with the commit tagged 1.9.2, at line 178: if rowIdx % 2 == 0 then --Even