Beispiel #1
0
        private Double getHandEV_BSList_Soft(List <Card> playersHand, List <Card> dealersCards)
        {
            //  Get the BS results for this hand
            int playerHandValue = BlackJack.getHandValue_Lower(playersHand);
            int dealerHandValue = (int)dealersCards[0].value;

            BSInfo BSResults = BSInfoArray_Soft_HitOnly[dealerHandValue, playerHandValue];

            if (BSResults.blackJackMove != BlackJackMove.Unknown)
            {
                return(BSResults.ev);
            }
            else
            {
                throw new Exception("Cannot evaluate unknown BS_Result object");
            }
        }
Beispiel #2
0
        private void ComputeSoftStrategy(List <Card> playersHand, List <Card> dealersCards)
        {
            //  Computing the soft strategy only requires we add an Ace to the hand.  Assuming the player had the hard value, and an Ace,
            //  We will determine the best move.
            Card        ace = new Card(CardValue.Ace, CardSuit.Hearts);
            List <Card> playersHand_Clone = new List <Card>(playersHand);

            playersHand_Clone.Add(ace);

            //  Detremine Stand EV
            masterLoseProbSum = 0;
            masterPushProbSum = 0;
            masterWinProbSum  = 0;
            ComputeStandEV(playersHand_Clone, dealersCards, 1);
            Double S_EV = masterWinProbSum - masterLoseProbSum;

            //  Determine Double EV
            masterLoseProbSum = 0;
            masterPushProbSum = 0;
            masterWinProbSum  = 0;
            ComputeHitEV_Double_Soft(playersHand_Clone, dealersCards, 1);
            Double D_EV = (masterWinProbSum - masterLoseProbSum) * 2;

            //  Determine BS_Hit EV
            EV_Total = 0;
            ComputeHitEV_BS(playersHand_Clone, dealersCards, 1);
            Double BS_EV = EV_Total;

            //  Add to the Soft Hit BS List
            //  Add to the Hit Chart (Highest EV if Can't Double)
            if (BS_EV >= S_EV)
            {
                BSInfoArray_Soft_HitOnly[(int)dealersCards[0].value, BlackJack.getHandValue_Lower(playersHand_Clone)].ev            = BS_EV;
                BSInfoArray_Soft_HitOnly[(int)dealersCards[0].value, BlackJack.getHandValue_Lower(playersHand_Clone)].blackJackMove = BlackJackMove.Hit;
            }
            else
            {
                BSInfoArray_Soft_HitOnly[(int)dealersCards[0].value, BlackJack.getHandValue_Lower(playersHand_Clone)].ev            = S_EV;
                BSInfoArray_Soft_HitOnly[(int)dealersCards[0].value, BlackJack.getHandValue_Lower(playersHand_Clone)].blackJackMove = BlackJackMove.Stay;
            }
            //  Add to the final Soft BS List
            BSInfo bestMove = getBestMoveFromEV(S_EV, D_EV, BS_EV);

            BSInfoArray_Soft[(int)dealersCards[0].value, BlackJack.getHandValue_Lower(playersHand_Clone)].ev            = bestMove.ev;
            BSInfoArray_Soft[(int)dealersCards[0].value, BlackJack.getHandValue_Lower(playersHand_Clone)].blackJackMove = bestMove.blackJackMove;
        }
Beispiel #3
0
        private void ComputeHardStrategy(List <Card> playerHand, List <Card> dealersHand)
        {
            //  Detremine Stand EV
            masterLoseProbSum = 0;
            masterPushProbSum = 0;
            masterWinProbSum  = 0;
            ComputeStandEV(playerHand, dealersHand, 1);
            Double S_EV = masterWinProbSum - masterLoseProbSum;

            //  Determine Double EV
            masterLoseProbSum = 0;
            masterPushProbSum = 0;
            masterWinProbSum  = 0;
            ComputeHitEV_Double(playerHand, dealersHand, 1);
            Double D_EV = (masterWinProbSum - masterLoseProbSum) * 2;

            //  Determine BS_Hit EV
            EV_Total = 0;
            ComputeHitEV_BS(playerHand, dealersHand, 1);
            Double BS_EV = EV_Total;


            //  Add to the Hit Chart
            if (BS_EV >= S_EV)
            {
                BSInfoArray_Hard_HitOnly[(int)dealersHand[0].value, BlackJack.getHandValue(playerHand)].ev            = BS_EV;
                BSInfoArray_Hard_HitOnly[(int)dealersHand[0].value, BlackJack.getHandValue(playerHand)].blackJackMove = BlackJackMove.Hit;
            }
            else
            {
                BSInfoArray_Hard_HitOnly[(int)dealersHand[0].value, BlackJack.getHandValue(playerHand)].ev            = S_EV;
                BSInfoArray_Hard_HitOnly[(int)dealersHand[0].value, BlackJack.getHandValue(playerHand)].blackJackMove = BlackJackMove.Stay;
            }

            //  Add to the final BS Chart
            BSInfo bestMove = getBestMoveFromEV(S_EV, D_EV, BS_EV);

            BSInfoArray_Hard[(int)dealersHand[0].value, BlackJack.getHandValue(playerHand)].ev            = bestMove.ev;
            BSInfoArray_Hard[(int)dealersHand[0].value, BlackJack.getHandValue(playerHand)].blackJackMove = bestMove.blackJackMove;
        }
Beispiel #4
0
        private Double getHandEV_BSList(List <Card> playersHand, List <Card> dealersCards)
        {
            //  If the hand has busted, then return is always -1
            if (BlackJack.getHandValue(playersHand) > 21)
            {
                return(-1);
            }


            //  Get the BS results for this hand
            int    playerHandValue = BlackJack.getHandValue(playersHand);
            int    dealerHandValue = (int)dealersCards[0].value;
            BSInfo BSResults       = BSInfoArray_Hard_HitOnly[dealerHandValue, playerHandValue];

            if (BSResults.blackJackMove != BlackJackMove.Unknown)
            {
                return(BSResults.ev);
            }
            else
            {
                throw new Exception("Cannot evaluate unknown BS_Result object");
            }
        }