private void ResultForm_Load(object sender, EventArgs e) { // Get and show round and total scores on the ResultForm int[] roundScore = game.RoundScore; for (int i = 0; i < panelRoundScore.Controls.Count; i++) { panelRoundScore.Controls[i].Text = roundScore[i].ToString(); } labelTotalScore.Text = game.TotalScore.ToString(); // Generate the game result game.GenerateGameResult(); GameResult gameResult = game.Result; // Decide the result statement switch (gameResult) { case GameResult.PLAYER_WON: labelResult.Text = "Congratulation! You won!"; break; case GameResult.PLAYER_LOST: labelResult.Text = "You lose!!!!"; break; case GameResult.GAME_DRAW: labelResult.Text = "This game is a draw"; break; } }
static void PrintResult(NumberGame game) { game.GenerateGameResult(); GameResult result = new GameResult(); result = game.Result; Console.WriteLine("\n----------------------------------------------------------------------------------"); Console.WriteLine("RESULT"); if (result == GameResult.GAME_DRAW) { Console.WriteLine("THIS GAME WAS A DRAW"); } else if (result == GameResult.PLAYER_LOST) { Console.WriteLine("Awwwww. YOU LOSE!!!"); } else { Console.WriteLine("Congrats! YOU WON!!!"); } Console.WriteLine(); }