示例#1
0
 /// <summary>
 /// Sets all parameters to the class-level fields. Sets GameID to 'BLA'.
 /// </summary>
 /// <param name="deck">The deck to be used</param>
 /// <param name="dealer">The dealer of the game</param>
 /// <param name="player">The player of the game</param>
 public Blackjack(Deck deck, Dealer dealer, BJPlayer player)
 {
     this.deck   = deck;
     this.dealer = dealer;
     this.player = player;
     GameID      = "BLA";
 }
示例#2
0
 /// <summary>
 /// Checks the boolean properties of Bust, BlackjackWin, and Stand to determine the player's
 /// current hand status.
 /// </summary>
 /// <param name="player">Either human or dealer, since BJPlayer can hold a Dealer instance</param>
 /// <returns>0 if the 'player' has busted. 1 if the 'player' has blackjack/21. 2 if the 'player'
 /// has decided to stand. Otherwise returns -1</returns>
 public int CheckHandStatus(BJPlayer player)
 {
     // did player bust?
     if (player.PlayerHand.Bust)
     {
         return(0);
     }
     // does player have blackjack?
     else if (player.PlayerHand.BlackjackWin)
     {
         return(1);
     }
     // has player decided to stand?
     else if (player.Stand)
     {
         return(2);
     }
     // none of these applies, game will continue
     else
     {
         return(-1);
     }
 }