08 Mission Instructions

8. What Makes a Game?, part 3

You may have noticed, we still don’t quite have a game that works. We haven’t actually told our robot to look for us (still!) nor have we asked it to see if we are close enough to win the game!

Both of those tasks happen when the robot is in a Red Light status, so the next part of the code will slip right under the last Red Light command, but still inside the Until… loop. 

We’ll make this a short loop to keep the game interesting, but the most important thing to notice is that there are two separate conditional statements in this part of our code.  One is about the motion sensor, which will help the robot win the game, and the other one is about the distance sensor, which will help you win the game!

IF motion is detected during the Red Light stage of the game, THEN something will happen. 

IF the distance sensor notices you are close enough to win, THEN something will happen. 

For both of these conditions, the robot will need to stop playing the game and immediately report whether it won or lost the game.  So we’ll need to set motion_detected to either true or false and tell the robot to break out of loop so it stops playing the game. 

Now, try playing the game. What do you notice?  Are we done? Are there still some bugs we need to fix?