public void EndGame() { string endGameMessage; DialogResult answer; if (m_Game.CurrentGame != null) { winsCounter(); updatePictureBoxBoard(m_Game.CurrentGame); endGameMessage = string.Format( @"{0} ({1}/{2}) Would you like another round?", m_Game.GetWinnerName(), m_RedWins, m_YellowWins); answer = MessageBox.Show(endGameMessage, "Othelo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (answer == DialogResult.Yes) { m_Game.CurrentGame.InitializeBoard(); m_Game.CurrentGame.CalculateScore(); showScore(); m_Game.CurrentPlayerToPlay = Game.ePlayerId.Player1; this.updatePictureBoxBoard(m_Game.CurrentGame); showValidCells(); updateTitle(); this.Refresh(); } else { m_RedWins = 0; m_YellowWins = 0; this.Close(); } } }
private void printTheScoreAndTheWinner(OtheloGame i_Game) { Console.WriteLine("The game is over! The scores are:"); Console.WriteLine("{0} your score is: {1}", i_Game.Players[0].Name, i_Game.Players[0].Score); Console.WriteLine("{0} your score is: {1}", i_Game.Players[1].Name, i_Game.Players[1].Score); string theWinner = i_Game.GetWinnerName(); if (theWinner == null) { Console.WriteLine("It's a tie!"); } else { Console.WriteLine("The winner is {0} !!", theWinner); } }