Here's a new logic/puzzle game that I just started playing. The rules are pretty simple... you write a program that controls a robot with the goal of picking up all the stars. One neat thing about this game is that there are optimization, recursion, and other coding techniques that are incorporated into many of the puzzles.
Here's a link to the game: Robozzle.
You'll want to play the tutorials and a few of the easy rated puzzles first. I haven't yet attempted any puzzle rated more than 3/5 in difficulty. Here's one that I still can't figure out and it's killing me. Maybe I'll get lucky and someone can figure this one out and give me some help.
I'm clearly missing some fundamental concept/technique. The furthest I can get the robot is past the red square and make the first left turn after it. I just can't figure out how I can get the robot to make the subsequent blue corner turns afterward.
Help Me -- Puzzle 1043: Fermat's Spiral 3
Enjoy the game!
5 comments:
cool site. thx for sharing. try this:
fwd
f1 blue
right
f1 green
left
fwd
Hah! I just independently got this one right about 5 minutes ago. That was my final answer as well. It took me way longer than I would have liked though.
I don't understand why it reverts to blue F1 after the last fwd command, i thought you had to put in a loop command at the end
this is why i couldn't make it through CS60
I think what you're missing is the notion of the call stack that exists, which will keep doing stuff as the recursion unwinds.
For example, say we had a 4 line program.
1. Forward
2. F1 Blue
3. Turn Right
4. Forward
And, say we have have 5 blue squares in front of us and then a green one (X B B B B B G).
We would run (1) initially then we would get to (2), which pushes us back to (1), but remember that the program from the initial call still needs to finish up and run (3) and (4) after (if not an infinite loop).
So, what happens? We end up calling (1) 6 times. Once for the initial call, and 5 times due to the 5 blue squares (F1 Blue). Now, we're on green. We then do nothing for (2) and then we do (3) and (4) and we return.
Upon return, we have to continue where we had left off from the most recent call of the program, which puts us at (3) from the previous call. And, you'll see how it chains up and repeats. So we'd end up doing (3) and (4) repeatedly for each call of the entire program.
I guess this was a bit long-winded, and maybe not all that clear, but hopefully you get what I mean.
Help me puzzle 244
Post a Comment