GR.Gambling.Blackjack.PseudoOptStrategy.TakeInsurance C# (CSharp) Method

TakeInsurance() public method

public TakeInsurance ( Game game ) : bool
game Game
return bool
        public override bool TakeInsurance(Game game)
        {
            // the number of seen tens
            int tens_count = counts[9];

            // check if newly dealt player hand has tens and add them to the count
            if (game.PlayerHandSet.ActiveHand[0].IsTenValue())
                tens_count++;
            if (game.PlayerHandSet.ActiveHand[1].IsTenValue())
                tens_count++;

            // switch to number of tens still in shoe
            tens_count = game.Rules.Decks * 4 * 4 - tens_count;

            // the -1 unknown comes from the ace we know the dealer has
            if (((double)tens_count / (double)(game.Shoe.Count - 1)) > (1.0 / 3.0))
                return true;

            return false;
        }