GR.Gambling.Blackjack.BonusPairsAgent.GetActions C# (CSharp) Method

GetActions() public method

public GetActions ( CardSet seen_cards, Card dealer_upcard, CardSet player_hands, int active_hand, List available_actions ) : List
seen_cards CardSet
dealer_upcard Card
player_hands CardSet
active_hand int
available_actions List
return List
        public List<ActionEv> GetActions(CardSet seen_cards, Card dealer_upcard, CardSet[] player_hands, int active_hand, List<ActionType> available_actions)
        {
            ValidateActions(player_hands[active_hand], available_actions);

            Shoe tmp_shoe = shoe.Copy();
            tmp_shoe.Remove(seen_cards);

            Eval.CacheDealerProbs(dealer_upcard.PointValue, tmp_shoe.ToArray());

            List<ActionEv> actions = new List<ActionEv>();

            foreach (ActionType a in available_actions)
            {
                double ev = GetActionEV(tmp_shoe, player_hands[active_hand], a, dealer_upcard);

                actions.Add(new ActionEv() { Action = a, Ev = ev });
            }

            actions.Sort(delegate(ActionEv ae1, ActionEv ae2) { return ae2.Ev.CompareTo(ae1.Ev); });

            game_logger.Action(dealer_upcard, player_hands, active_hand, actions);

            return actions;
        }

Usage Example

        public override List <ActionEv> GetActions(Game game)
        {
            List <ActionType> allowed_actions = new List <ActionType>();

            if (game.IsValidAction(ActionType.Stand))
            {
                allowed_actions.Add(ActionType.Stand);
            }
            if (game.IsValidAction(ActionType.Hit))
            {
                allowed_actions.Add(ActionType.Hit);
            }
            if (game.IsValidAction(ActionType.Double))
            {
                allowed_actions.Add(ActionType.Double);
            }
            if (game.IsValidAction(ActionType.Split))
            {
                allowed_actions.Add(ActionType.Split);
            }
            if (game.IsValidAction(ActionType.Surrender))
            {
                allowed_actions.Add(ActionType.Surrender);
            }


            CardSet some_cards = new CardSet();

            //Hand active_hand = game.PlayerHandSet.ActiveHand;

            List <CardSet> player_hands = new List <CardSet>();

            foreach (Hand hand in game.PlayerHandSet)
            {
                player_hands.Add(hand.Cards);
            }

            return(agent.GetActions(GetSeenCards(game, false), game.DealerHand[0], player_hands.ToArray(), game.PlayerHandSet.ActiveIndex, allowed_actions));
        }