Example #1
0
        private void printAndUpdateScores()
        {
            PlayerDetails winner, loser;
            string        gameOverMessage;

            if (m_Game.GetWinner(out winner, out loser))
            {
                gameOverMessage = getScoreMessage(winner, loser, winner.GameScore, loser.GameScore);
                m_Game.UpdateScoresForNewGame(winner, loser);
            }
            else
            {
                gameOverMessage = string.Format("Its a tie!");
            }

            DialogResult result = MessageBox.Show(gameOverMessage, "Another Round?", MessageBoxButtons.YesNo);

            if (result.Equals(DialogResult.Yes))
            {
                m_FirstPlayerScoreLabel.Text  = getNamesAndScores(r_FirstPlayer);
                m_SecondPlayerScoreLabel.Text = getNamesAndScores(r_SecondPlayer);
                m_Game            = new CheckersGameLogic.CheckersLogic(r_FirstPlayer, r_SecondPlayer, r_BoardSize, r_GameStyle);
                m_FirstPlayerMove = true;
                setPawns();
                decideWhicePlayerMove();
                m_FirstPlayerMove = !m_FirstPlayerMove;
            }
            else
            {
                MessageBox.Show("Thanks for playing!");
                this.Close();
            }
        }
Example #2
0
 public CheckersForm(
     int i_BoardSize,
     PlayerDetails i_FirtsPlayer,
     PlayerDetails i_SecondPlayer,
     eGameStyle i_GameStyle)
 {
     r_GameStyle    = i_GameStyle;
     r_BoardSize    = i_BoardSize;
     r_FirstPlayer  = i_FirtsPlayer;
     r_SecondPlayer = i_SecondPlayer;
     r_GameBoard    = new ButtonProxy[r_BoardSize, r_BoardSize];
     m_Game         = new CheckersGameLogic.CheckersLogic(i_FirtsPlayer, i_SecondPlayer, i_BoardSize, i_GameStyle);
     initializeComputerMoveGeneratorIfNeeded();
     initializeControls();
 }