📖 Instructions#
Here are the steps needed to implement an Odds and Evens game:
Spoiler Alert. Reveal only after completing the previous lesson.
- Player chooses to play with odds or evens.
- Player enters a number between 1 and 2.
- Computer randomly generates a number between 1 and 2.
- Add the two numbers.
- Check if the sum is odd or even.
- Decide the round winner.
- Repeat rounds until one of the players wins two times.
- Announce the game winner.
- Ask the player to play again or quit.
These steps will serve as a roadmap for building the game.
We’ll add these steps directly to the program file using comments. This helps guiding the process and working through the problem one step at a time.
🎓 Learn
✅ What to Do#
- Write each step in your program file using a single-line comment.
💡 Hints#
Hint 1
Write the steps directly in your main program file, right after the welcome message. This is where the game logic will go.
Hint 2
Write one step per line, keeping the same order as your plan.
🙈 Solution#
Tried, you must, before reveal the solution you may.
Program.csChanges
Console.WriteLine("Hello world!");
++
++ // Player chooses to play with odds or evens.
++ // Player enters a number between 1 and 2.
++ // Computer randomly generates a number between 1 and 2.
++ // Add the two numbers.
++ // Check if the sum is odd or even.
++ // Decide the round winner.
++ // Repeat rounds until one of the players wins two times.
++ // Announce the game winner.
++ // Ask the player to play again or quit.
Program.csFinal
Console.WriteLine("Hello world!");
// Player chooses to play with odds or evens.
// Player enters a number between 1 and 2.
// Computer randomly generates a number between 1 and 2.
// Add the two numbers.
// Check if the sum is odd or even.
// Decide the round winner.
// Repeat rounds until one of the players wins two times.
// Announce the game winner.
// Ask the player to play again or quit.