Break Down the Game Mechanics

📖 Instructions#

An essential step in learning programming is learning how to think like a programmer.

This means breaking down goals or problems into clear steps. It helps you understand the problem and prevents you from missing important parts.

The goal here is to build an Odds and Evens game where the player plays against the computer. Start by understanding how the game works: how it begins, how each round is played, and how the winner is decided.

Then, translate that understanding into steps. Write down everything that needs to happen, from starting the game to displaying the result.

🧠 Recall

✅ What to Do#

Read the rules of Odds and Evens (external link), then write down all the steps required to play one full game — from start to finish.

🎯 Expected Outcome#

A numbered list of steps that covers the full game — from the player making their choice to the game announcing a winner and asking to play again. There is no program output for this lesson; the deliverable is your written plan.

💡 Hints#

Hint 1

Define the goal of the game. What should happen from start to finish?

Hint 2

Identify the inputs and outputs. What does the player enter, and what should be shown?

Hint 3

Clarify the rules. How do you determine the result or winner?

Hint 4

Break the solution into ordered steps. What happens first, next, and last?

⚠️ Common Mistakes#

Writing steps that are too vague

“Play the game” is not a step — it’s the whole thing. Each step should describe one specific thing that happens. If a step could be broken down further, break it down.

Skipping the player’s choices

The player makes decisions during the game — choosing odds or evens, entering a number. These are inputs and they need to be steps. A list that jumps straight to “determine the winner” without capturing what the player does is incomplete.

Forgetting about repetition

One round isn’t the whole game. The game repeats until someone wins enough rounds. If your steps only describe a single round, you’re missing the loop that makes it a full game.

🙈 Solution#

Tried, you must, before reveal the solution you may.
  1. Player chooses to play with odds or evens.
  2. Player enters a number between 1 and 2.
  3. Computer randomly generates a number between 1 and 2.
  4. Add the two numbers.
  5. Check if the sum is odd or even.
  6. Decide the round winner.
  7. Repeat rounds until one of the players wins two times.
  8. Announce the game winner.
  9. Ask the player to play again or quit.