Posted 17 March 2013 - 11:40 PM
I'm making my wood cutter, and I'm trying to make the turtle wait until the tree has grown. I'm just using a repeat until to check when there's no longer a sapling in front of it. But the problem is, is it eventually stops repeating. It doesn't harm anything in my program, nor does it break the turtle. But it does make the turtle break the saplings and replant them, despite there not being a tree there.
I attempted to debug this using the following code:
It's currently at 6000 repeats, without any problems. With the code in the actual turtle, that would be about 500 minutes - far more than the amount of time it took the repeat to break.
The code that is breaking in the turtle:
So I'm wondering if there is any problems with the turtle.compare command, the repeat until loop, or if there is a better way to wait until a tree has grown.
I attempted to debug this using the following code:
count=0
repeat
print(count)
count=count+1
until not turtle.compare()
It's currently at 6000 repeats, without any problems. With the code in the actual turtle, that would be about 500 minutes - far more than the amount of time it took the repeat to break.
The code that is breaking in the turtle:
repeat
sleep(5)
until not turtle.compare()
So I'm wondering if there is any problems with the turtle.compare command, the repeat until loop, or if there is a better way to wait until a tree has grown.