📖 Instructions#
Now that you’ve broken down the game mechanics, you’ll use those steps as a roadmap for building the game. You’ll add them directly to the program file using comments — lines the computer ignores, written for the programmer’s benefit.
This technique keeps the plan visible while you work, so you can tackle one step at a time without losing track of the whole.
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.
🎓 Learn More
✅ What to Do#
Write each game step in your program file as a single-line comment.
🎯 Expected Outcome#
Program.cs should contain the original line followed by each game step written as a comment, one per line, in order.
Hello, World!
💡 Hints#
Hint 1
Write the steps directly in Program.cs, after the existing line. This is where the game logic will go.
Hint 2
Write one step per line in the same order as your plan. Each line should start with //.
⚠️ Common Mistakes#
Writing steps as code instead of comments
Comments start with //. If you write the steps without //, the compiler will try to read them as C# code and fail. Every step line must start with //.
Putting the comments in the wrong file
The comments go in Program.cs — the file that contains your program’s entry point. If you open another file by mistake and add comments there, nothing will break, but the steps won’t be where the code needs to go later.
Changing the order of the steps
The order matters — it reflects how the game actually runs. Writing the steps out of order will make the next lessons harder to follow, since each lesson builds on the previous one in sequence.
🙈 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.