Python by Projects › Arcade Night
Problems: Arcade Night
Tonight, your classroom becomes an arcade.
You will build a mini-arcade with two games, then invite classmates to play it. Every game earns points, and the scoreboard keeps the excitement going from one game to the next.
Milestone 1: Open the arcade
Build the menu that players will use all night. The while loop keeps showing the choices, input() lets the player choose, and break closes the arcade when the player enters q.
Pattern Spotlight: which pattern is this? which variable/condition says 'done yet?' Variation — data type: the done signal is the string q, unlike the number match in Number Detective. (This is one of the reusable algorithm-extension patterns collected in each unit's Algorithm Extension — its home is an earlier unit, and it returns in later ones.)
Run this starter, try every choice, and replace the TODO messages when your games are ready.
How this is checked: You check this one yourself, against the list below.
The site cannot check this one. Run your program, then tick each item below when your work does it.
Milestone 2: Build game one: Lucky Guess
Make a function for a quick guessing game. The computer picks an integer from 1 through 5 with random.randint, and the player tries to match it.
The starter always returns 0 points. Complete the TODO so a correct guess returns a real reward. Keep return points inside the function.
How this is checked: You check this one yourself, against the list below.
The site cannot check this one. Run your program, then tick each item below when your work does it.
Milestone 3: Build game two: Quick Quiz
Make another function that returns points. This game asks two quick questions, then uses and, or, and an if/elif/else chain to choose a score.
Complete both scoring TODOs. Award more points for two correct answers than for one correct answer. Then replace the final TODO comment with a return statement that sends points back to the arcade.
How this is checked: You check this one yourself, against the list below.
The site cannot check this one. Run your program, then tick each item below when your work does it.
Milestone 4: Connect the games and keep score
Now turn the pieces into one arcade. score accumulates the points returned by each game. rounds_played counts a round only when the player chooses a game. The f-string scoreboard shows both totals.
This scaffold calls your two functions. Finish the TODOs in those functions first, then personalize the menu messages here.
How this is checked: You check this one yourself, against the list below.
The site cannot check this one. Run your program, then tick each item below when your work does it.
Make it yours
Choose an extension after your two-game arcade works.
- Add a third game function that returns points, such as a one-guess mystery number or another two-question quiz. Add its number to the menu with another
elifbranch. - Add a high-score message. After showing the scoreboard, use an
ifcomparison to print a special message whenscoreis above a target you choose. - Add a difficulty toggle with a function parameter. For example, change the first line to
def lucky_guess(difficulty):, pass in an integer, and useif/elifto choose the largest lucky number or the points awarded.
Requirements checklist
Your arcade must: use at least two game functions that RETURN points; keep a running total score; let the player quit.
Before Arcade Night begins, check every box.
- [ ] My arcade uses at least two game functions that RETURN points.
- [ ] My arcade keeps a running total score.
- [ ] My arcade lets the player quit.