Exemplo n.º 1
0
        public static void PlayAutoGameSession(AutoPockerGame autoGame)
        {
            autoGame.ServeCardsToPlayers();
            var winners = autoGame.Winners;

            winners.PrintResult(autoGame.ToString(), "");

            Console.WriteLine($"Press 'R' to re-play another, 'P' to change players or 'X' to exit auto play");
            var option = ConsoleHelper.GetStringInput(new List <string>()
            {
                "R", "P", "X"
            });

            switch (option)
            {
            case "R":
                PlayAutoGameSession(autoGame);
                break;

            case "P":
                Console.Clear();
                PlayAutoGame();
                break;

            default:
                Console.Clear();
                //just exit this method
                break;
            }
        }
Exemplo n.º 2
0
        public static void PlayAutoGame()
        {
            AutoPockerGame autoGame = new AutoPockerGame();
            //collect list of players

            string players = ConsoleHelper.GetStringInput("Provide comma separated list of players", (input) =>
            {
                if (string.IsNullOrWhiteSpace(input))
                {
                    return(new InputValidationState()
                    {
                        Status = false,
                        Message = "Please provide comma separated list of player names"
                    });
                }
                if (input.Trim().IndexOf(",") < 0)
                {
                    return(new InputValidationState()
                    {
                        Status = false,
                        Message = "You must provide more than one name separated by comma"
                    });
                }
                return(new InputValidationState()
                {
                    Status = true
                });
            });

            autoGame.StartGame(players);
            PlayAutoGameSession(autoGame);
        }