Now that we store the player’s choice in a variable, the next step is to print which side each one will play.
There are only two possible outcomes:
For now, let’s print both possible outcomes.
The Game Utilities include a function to display informative game messages like these.
💻 C#
GamePrint.Message("Message");🖨️ Console
## Message ##
✅ What to Do
🎯 Expected Outcome
🖨️ Console
+--------------------------------+
+-- Welcome to Odds and Evens! --+
+--------------------------------+
--> Choose 1 for Odds or 2 for Evens:
1
## You chose Odds, Computer is Evens ##
## You chose Evens, Computer is Odds ##
✏️ Program.cs - Changes
GamePrint.Box("Welcome to Odds and Evens!");
// Player chooses to play with odds or evens.
GamePrint.Input("Choose 1 for Odds or 2 for Evens");
int playerSide = GameInput.Number(1, 2);
++ GamePrint.Message("You chose Odds, Computer is Evens");
++ GamePrint.Message("You chose Evens, Computer is Odds");🗒️ Program.cs - Final
GamePrint.Box("Welcome to Odds and Evens!");
// Player chooses to play with odds or evens.
GamePrint.Input("Choose 1 for Odds or 2 for Evens");
int playerSide = GameInput.Number(1, 2);
GamePrint.Message("You chose Odds, Computer is Evens");
GamePrint.Message("You chose Evens, Computer is Odds");
(...)