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

GetActions() public method

public GetActions ( Game game ) : List
game Game
return List
        public override List<ActionEv> GetActions(Game game)
        {
            List<ActionEv> actions = new List<ActionEv>();

            int[] shoe = game.Shoe.Counts;
            /*int[] test = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            int test_count = 0;
            foreach (Card card in game.Shoe)
            {
                test[card.PointValue - 1]++;
                test_count++;
            }
            for (int i = 0; i < 10; i++)
            {
                if (test[i] != shoe[i])
                {
                    Console.Write(game.Shoe.Count + "| ");
                    for (int j = 0; j < 10; j++)
                        Console.Write(shoe[j] + " ");
                    Console.WriteLine();
                    Console.Write(test_count + "| ");
                    for (int j = 0; j < 10; j++)
                        Console.Write(test[j] + " ");
                    Console.WriteLine();

                    Console.ReadLine();
                    break;
                }
            }*/
            shoe[game.DealerHand[1].PointValue - 1]++;

            SHand shand;
            int soft_total = game.PlayerHandSet.ActiveHand.SoftTotal();
            if (soft_total <= 21 && game.PlayerHandSet.ActiveHand.HasAce())
            {
                shand.Total = soft_total;
                shand.Soft = true;
            }
            else
            {
                shand.Total = game.PlayerHandSet.ActiveHand.HardTotal();
                shand.Soft = false;
            }

            int upcard = game.DealerHand[0].PointValue;
            int split_card = game.PlayerHandSet.ActiveHand[0].PointValue;

            BjEval.Eval.CacheDealerProbs(upcard, shoe);
            /*
                        for (int i = 0; i < 10; i++)
                            Console.Write(shoe[i] + " ");
                        Console.WriteLine();

                        Console.WriteLine("SHand: " + shand.Total + " soft=" + shand.Soft);
                        */
            if (game.IsValidAction(ActionType.Stand))
                actions.Add(new ActionEv() { Action = ActionType.Stand, Ev = BjEval.Eval.StandEv(shand, upcard, shoe) });
            if (game.IsValidAction(ActionType.Hit))
                actions.Add(new ActionEv() { Action = ActionType.Hit, Ev = BjEval.Eval.HitEv(shand, upcard, shoe) });
            if (game.IsValidAction(ActionType.Double))
                actions.Add(new ActionEv() { Action = ActionType.Double, Ev = BjEval.Eval.DoubleEv(shand, upcard, max_bet, shoe) });
            if (game.IsValidAction(ActionType.Surrender))
                actions.Add(new ActionEv() { Action = ActionType.Surrender, Ev = BjEval.Eval.SurrenderEv() });
            if (game.IsValidAction(ActionType.Split))
                actions.Add(new ActionEv() { Action = ActionType.Split, Ev = BjEval.Eval.SplitEv(split_card, upcard, max_bet, game.Rules.Splits - game.SplitCount, shoe) });

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

            return actions;
        }