GR.Gambling.Blackjack.Hand.IsNatural C# (CSharp) Method

IsNatural() public method

public IsNatural ( ) : bool
return bool
        public bool IsNatural()
        {
            if ((cards[0].IsTenValue() && cards[1].IsAce()) ||
                (cards[1].IsTenValue() && cards[0].IsAce()))
                return true;

            return false;
        }

Usage Example

コード例 #1
0
        private int ExpectedMoney(Hand dealer, Hand[] player)
        {
            int game_bet       = 100 * current_bet;
            int expected_money = 0;

            if (insurance_taken)
            {
                expected_money -= game_bet / 2;

                if (dealer.IsNatural())
                {
                    expected_money += 3 * game_bet / 2;
                }
            }

            if (surrendered)
            {
                expected_money -= game_bet / 2;
            }
            else
            {
                foreach (Hand hand in player)
                {
                    int hand_bet = hand.Doubled ? (game_bet * 2) : game_bet;

                    expected_money -= hand_bet;

                    if (dealer.IsNatural())
                    {
                        if (hand.IsNatural())
                        {
                            expected_money += hand_bet;
                        }
                    }
                    else if (split_count == 0 && hand.IsNatural())
                    {
                        expected_money += 2 * hand_bet + hand_bet / 2;
                    }
                    else if (dealer.IsBust())
                    {
                        if (!hand.IsBust())
                        {
                            expected_money += 2 * hand_bet;
                        }
                    }
                    else if (!hand.IsBust())
                    {
                        int player_total = hand.PointCount();
                        int dealer_total = dealer.PointCount();

                        if (player_total < dealer_total)
                        {
                            // do nothing, we lose our bet
                        }                         // we win, 2:1 payout
                        else if (dealer_total < player_total)
                        {
                            expected_money += 2 * hand_bet;
                        }                         // push
                        else
                        {
                            expected_money += hand_bet;
                        }
                    }
                }
            }

            return(expected_money);
        }
All Usage Examples Of GR.Gambling.Blackjack.Hand::IsNatural