Basic goal and why. I built a massive building and I made the roof glass but I don't like the glass and thought it would be fun to make turtle break and replace the pieces. So basically what I wanted him to do is start at the right side of the building, do turtle.compare() against stone bricks (outline of glass) then go left and break glass and replace in straight line then when he hit the next border, go right and continue. the problem I ran into is he just loops left. I wanted to run a while loop instead of for. What I was doing is x = x+1 and when x%2 it was a left and anything else was a right. How would I fix this to run.
http://pastebin.com/QLkSapzc
How do I get my turtle to go right after going left last time
Started by skydude92, Apr 07 2013 11:03 AM
2 replies to this topic
#1
Posted 07 April 2013 - 11:03 AM
#2
Posted 07 April 2013 - 11:29 AM
Because what you want is x%2 == 0 or not. %, or modulus, is just an operator like + or *.
As you have it written, it's just always true, therefore it is always left.
As you have it written, it's just always true, therefore it is always left.
#3
Posted 07 April 2013 - 11:32 AM
ty. for some reason I was trying to make it check for "is divisible by 2" and I thought thats how. but that worked.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











