08 Quick Start
Your mission is to design a robot that can be the Traffic Light for a game of Red Light, Green Light.
Then plug the Motion Sensor and Distance Sensor into the AD ports.
Then explore the Motion Sensor using the Sensor Control Panel in Bloxter.
Code: Start with the End in Mind!
Create two new functions. One for robot_wins and another for robot_loses.
Code: When to Win or Lose
Use a new variable to create the conditional statement that activates each Game End Function.
Code: Play the Game
In Red Light, Green Light, the Traffic Light switches between a Green Light, which invites all the other players to move forward, and a Red Light, which means everyone needs to freeze.
Use the eyes on your robot to signal Green Light and Red Light.
What Makes a Game?
In the first iteration of your game, it's likely the robot declares victory or loss every time it turns red. To get around this, you might need to add a repeat-until loop. Think carefully about what logic will need to be in place for the robot to keep playing multiple rounds of the game.
Fun and Fair Games are Best
Time to tweak your program so the robot occasionally loses! Try building in a motion_count variable to give yourself a fighting chance.
When you're ready, put your robot to the test by playing a few rounds with your robot. If you're program is effective, you'll be able to win a couple rounds and also lose one or two!
Time to get creative! You might want to add a getting_started countdown so you have time to start the program and get into place!