// Handles button event - the user wants to play against a friend. private void m_VsHuman_Click(object sender, EventArgs e) { this.Hide(); m_OthelloMainForm = new OthelloMainGameForm(true, m_BoardSize); }
// Handles button event - the user wants to play against a computer. private void m_VsComputer_Click(object sender, EventArgs e) { this.Hide(); m_OthelloMainForm = new OthelloMainGameForm(false, m_BoardSize); }
// Displaying a summary message of the competition and an option of playing another round. private void currentGameSummary() { List<int> scores = m_MainOthelloLogic.GetScore(); string summary = string.Empty; if (scores[0] != scores[1]) { summary = string.Format( "{0} Won!! ({1}/{2}) ({3}/{4}) {5}Would you like another round?", m_MainOthelloLogic.GetWinner(), scores[0], scores[1], s_Player1Victories, s_Player2Victories, Environment.NewLine); } else { // In case of a tie in the current game. summary = string.Format( "Draw!! ({0}/{1}) ({2}/{3}) {4}Would you like another round?", scores[0], scores[1], s_Player1Victories, s_Player2Victories, Environment.NewLine); } DialogResult messageResult = MessageBox.Show(summary, "Othello", MessageBoxButtons.YesNo); if (messageResult == DialogResult.Yes) { this.Hide(); OthelloMainGameForm newGame = new OthelloMainGameForm(r_VsHuman, r_BoardSize); } System.Environment.Exit(0); }