Posted 01 May 2013 - 01:28 AM
Title: Boolean value randomly changes in program
I found a program online that was a bare bones 2x2 tree lumberjack program, I took it and added a few bells and whistles (args, special stuff for my specific case), cleaned up the code, etc. It has run perfectly fine for a while but recently the boolean that holds whether the tree is grown or not (isGrown) seems to randomly switch to true even if the tree isn't grown yet… this caused the turtle to decide it was a good idea to burrow to the center of the earth (until I put a special case to stop it). Now it just kind of tears up the 2x2 patch of ground the saplings are on.
TL;DR: The boolean variable isGrown in the following code (http://pastebin.com/scZHfMmT) seemingly randomly switches from false to true without any reason. I was hoping a fresh set of eyes could see what is going on…
Thanks in advance!
I found a program online that was a bare bones 2x2 tree lumberjack program, I took it and added a few bells and whistles (args, special stuff for my specific case), cleaned up the code, etc. It has run perfectly fine for a while but recently the boolean that holds whether the tree is grown or not (isGrown) seems to randomly switch to true even if the tree isn't grown yet… this caused the turtle to decide it was a good idea to burrow to the center of the earth (until I put a special case to stop it). Now it just kind of tears up the 2x2 patch of ground the saplings are on.
TL;DR: The boolean variable isGrown in the following code (http://pastebin.com/scZHfMmT) seemingly randomly switches from false to true without any reason. I was hoping a fresh set of eyes could see what is going on…
Thanks in advance!