08 Mission Instructions

4. Code: When to Win or Lose

Of course, now that you’ve designed the robot reactions to winning and losing, we’ll need to start building a game for the robot to play with you! 

We’re still thinking backward for a minute: If the robot does not see you move when the light is red, then you win! And If the robot catches you moving when you shouldn’t be, then you lose.  

Because the most important thing to keep track of is your motion, we’ll create a variable called motion_detected and start the game with it set to false. It’s definitely not going to be a fair game if the robot thinks you’re moving before it begins using the motion sensor or distance sensor!

Then we’ll create the end-of-game conditional statement.

Feel free to fiddle around with this conditional statement.  

What happens if you set motion_detected to true instead?

Keep it simple. We can always come back and tweak it later as we learn more about our game.