Upcard() public method

public Upcard ( ) : Card
return Card
Ejemplo n.º 1
0
        public override ActionType GetBestAction(Game game)
        {
            Console.WriteLine("Upcard: " + game.Upcard() + " | Hand: " +
                              game.PlayerHandSet.ActiveHand + " (" +
                              game.PlayerHandSet.ActiveHand.PointCount() + ")");

            if (game.IsValidAction(ActionType.Hit))
            {
                Console.Write("(H)it ");
            }
            if (game.IsValidAction(ActionType.Stand))
            {
                Console.Write("(S)tand ");
            }
            if (game.IsValidAction(ActionType.Surrender))
            {
                Console.Write("Sur(r)ender ");
            }
            if (game.IsValidAction(ActionType.Split))
            {
                Console.Write("S(p)lit ");
            }
            if (game.IsValidAction(ActionType.Double))
            {
                Console.Write("(D)ouble ");
            }

            string input = Console.ReadLine();

            if (input[0] == 'h')
            {
                return(ActionType.Hit);
            }
            if (input[0] == 's')
            {
                return(ActionType.Stand);
            }
            if (input[0] == 'r')
            {
                return(ActionType.Surrender);
            }
            if (input[0] == 'p')
            {
                return(ActionType.Split);
            }
            if (input[0] == 'd')
            {
                return(ActionType.Double);
            }

            Console.WriteLine("Ops");
            return(ActionType.Surrender);
        }
Ejemplo n.º 2
0
        private List <ActionEv> Evaluate(Game game)
        {
            shell.StandardInput.WriteLine("h");
            for (int i = 0; i < 9; i++)
            {
                shell.StandardInput.WriteLine(32 - counts[i]);
            }
            shell.StandardInput.WriteLine(128 - counts[9]);

            shell.StandardInput.WriteLine(game.Upcard().PointValue);

            shell.StandardInput.WriteLine(game.PlayerHandSet.ActiveHand.Count);

            foreach (Card card in game.PlayerHandSet.ActiveHand)
            {
                shell.StandardInput.WriteLine(card.PointValue);
            }

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

            if (game.IsValidAction(ActionType.Hit))
            {
                actions.Add(Ev("h"));
            }
            if (game.IsValidAction(ActionType.Stand))
            {
                actions.Add(Ev("t"));
            }
            if (game.IsValidAction(ActionType.Double))
            {
                actions.Add(Ev("d"));
            }
            if (game.IsValidAction(ActionType.Split))
            {
                actions.Add(Ev("s"));
            }
            if (game.IsValidAction(ActionType.Surrender))
            {
                actions.Add(Ev("S"));
            }

            shell.StandardInput.WriteLine("q");

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

            /*Console.WriteLine("Upcard: " + upcard + " Hand: " + hand);
             * foreach (ActionEv ae in actions)
             *      Console.WriteLine(ae.Action + " " + ae.Ev);
             * Console.ReadKey();*/

            return(actions);
        }
Ejemplo n.º 3
0
        public override ActionType GetBestAction(Game game)
        {
            List <ActionEv> actions = Evaluate(game.Upcard(), game.PlayerHandSet.ActiveHand);

            foreach (ActionEv ae in actions)
            {
                if (game.IsValidAction(ae.Action))
                {
                    return(ae.Action);
                }
                else
                {
                    //Console.WriteLine("OMGGG " + ae.Action);
                }
            }
            Console.WriteLine("BIG FUCCCCKKK");

            return(ActionType.Split);
        }
Ejemplo n.º 4
0
        public override ActionType GetBestAction(Game game)
        {
            List<ActionEv> actions = Evaluate(game.Upcard(), game.PlayerHandSet.ActiveHand);

            foreach (ActionEv ae in actions)
            {
                if (game.IsValidAction(ae.Action))
                    return ae.Action;
                else
                {
                    //Console.WriteLine("OMGGG " + ae.Action);
                }
            }
            Console.WriteLine("BIG FUCCCCKKK");

            return ActionType.Split;
        }
Ejemplo n.º 5
0
        private List<ActionEv> Evaluate(Game game)
        {
            shell.StandardInput.WriteLine("h");
            for (int i = 0; i < 9; i++)
                shell.StandardInput.WriteLine(32 - counts[i]);
            shell.StandardInput.WriteLine(128 - counts[9]);

            shell.StandardInput.WriteLine(game.Upcard().PointValue);

            shell.StandardInput.WriteLine(game.PlayerHandSet.ActiveHand.Count);

            foreach (Card card in game.PlayerHandSet.ActiveHand)
                shell.StandardInput.WriteLine(card.PointValue);

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

            if (game.IsValidAction(ActionType.Hit))
                actions.Add(Ev("h"));
            if (game.IsValidAction(ActionType.Stand))
                actions.Add(Ev("t"));
            if (game.IsValidAction(ActionType.Double))
                actions.Add(Ev("d"));
            if (game.IsValidAction(ActionType.Split))
                actions.Add(Ev("s"));
            if (game.IsValidAction(ActionType.Surrender))
                actions.Add(Ev("S"));

            shell.StandardInput.WriteLine("q");

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

            /*Console.WriteLine("Upcard: " + upcard + " Hand: " + hand);
            foreach (ActionEv ae in actions)
                Console.WriteLine(ae.Action + " " + ae.Ev);
            Console.ReadKey();*/

            return actions;
        }
Ejemplo n.º 6
0
        public override ActionType GetBestAction(Game game)
        {
            Console.WriteLine("Upcard: " + game.Upcard() + " | Hand: " +
                              game.PlayerHandSet.ActiveHand + " (" +
                              game.PlayerHandSet.ActiveHand.PointCount() + ")");

            if (game.IsValidAction(ActionType.Hit))
                Console.Write("(H)it ");
            if (game.IsValidAction(ActionType.Stand))
                Console.Write("(S)tand ");
            if (game.IsValidAction(ActionType.Surrender))
                Console.Write("Sur(r)ender ");
            if (game.IsValidAction(ActionType.Split))
                Console.Write("S(p)lit ");
            if (game.IsValidAction(ActionType.Double))
                Console.Write("(D)ouble ");

            string input = Console.ReadLine();

            if (input[0] == 'h') return ActionType.Hit;
            if (input[0] == 's') return ActionType.Stand;
            if (input[0] == 'r') return ActionType.Surrender;
            if (input[0] == 'p') return ActionType.Split;
            if (input[0] == 'd') return ActionType.Double;

            Console.WriteLine("Ops");
            return ActionType.Surrender;
        }