コード例 #1
0
 /// <summary>
 /// Plays the next game round.
 /// </summary>
 /// <returns>
 /// True - if can play another round, False - to end the game
 /// </returns>
 private bool PlayNextRound()
 {
     // In debug mode, check that the total amount of money remaind.
     Invariant.CheckMoneySum(this);
     // Get a new game for the current round.
     game = GetNewGame();
     // Create a new side pot
     pot = new SidePot(players);
     // Increase hand count
     RaiseHandCount();
     // Initialize the game for the current amount of players.
     game.BeginGame(players.Count);
     // Map the playing players and the round order, blind open & blind raise
     mapPlayersAndBlindOpen();
     // finish the blind raise round
     handleFirstRaise();
     // Call derived class to continue the game round
     OnPlayNextRound();
     // find the winner(s) and distribute the earnings
     handleEndGame(game.EndGame());
     // since derived classes and helpers may remove players, verify there are any...
     if (players.Count == 0)
     {
         return(false);
     }
     // In debug mode, check that the total amount of money remaind.
     Invariant.CheckMoneySum(this);
     // move the dealer chip one place
     ++dealer;
     dealer = dealer % players.Count;
     // Check if there are more players
     if (players.Count > 1)
     {
         // Use derive class to determine if another round should be played
         return(WaitForAnotherRound());
     }
     else // there are no more players.
     {
         // Notify the game is over and stop the game
         WaitGameOver(players[0]);
         return(false);
     }
 }