예제 #1
0
 /// <summary>
 ///     Determines whether [is double down success] [the specified hand].
 /// </summary>
 /// <param name="hand">The hand.</param>
 /// <param name="shoe">The shoe.</param>
 /// <returns>
 ///     <c>true</c> if [is double down success] [the specified hand]; otherwise, <c>false</c>.
 /// </returns>
 public bool IsDoubleDownSuccess(BjHand hand, BjShoe shoe)
 {
     if (!HandExists(hand))
     {
         return(false);
     }
     return(hand.HitHand(shoe));
 }
예제 #2
0
        /// <summary>
        ///     Deals the new round.
        /// </summary>
        /// <param name="shoe">The shoe.</param>
        /// <returns></returns>
        public bool DealNewRound(BjShoe shoe)
        {
            var hand = new BjHand(CurrentBet);

            if (!hand.HitHand(shoe))
            {
                return(false);
            }

            CurrentHands = new List <BjHand> {
                hand
            };
            return(true);
        }
예제 #3
0
        /// <summary>
        ///     Deals the round starting cards.
        /// </summary>
        /// <param name="shoe">The shoe.</param>
        /// <param name="players">The players.</param>
        /// <returns></returns>
        public bool DealRoundStartingCards(BjShoe shoe, List <BjPlayer> players)
        {
            var allPlayersDealt = true;

            CurrentHand = new BjHand();
            for (int i = 0; i < 2; i++)
            {
                foreach (var player in players)
                {
                    if (player.CurrentBet <= 0 || player.CurrentBet > player.Chips || player.CurrentBet < Blackjack.CurrentGame.MinimumBet)
                    {
                        Log.Info($"DealRoundStartingCards: bet={player.CurrentBet},chips={player.Chips},minBet={Blackjack.CurrentGame.MinimumBet}");
                        allPlayersDealt = false;
                        continue;
                    }
                    if (i == 0)
                    {
                        if (!player.DealNewRound(shoe))
                        {
                            Log.Info($"Failed to deal player new round.");
                            return(false);
                        }
                    }
                    else
                    {
                        var hand = player.CurrentHands.FirstOrDefault();
                        if (!player.IsHitSuccess(hand, shoe))
                        {
                            Log.Info($"Failed to deal player 2nd card.");
                            return(false);
                        }
                    }
                }

                if (!CurrentHand.HitHand(shoe))
                {
                    Log.Info($"Failed to hit dealer.");
                    return(false);
                }
            }

            return(allPlayersDealt);
        }