Ejemplo n.º 1
0
        public override PlayerTask GetMove(POGame poGame)
        {
            Console.WriteLine(poGame.PartialPrint());

            var player = poGame.CurrentPlayer;

            // During Mulligan: select Random cards
            if (player.MulliganState == Mulligan.INPUT)
            {
                List <int> mulligan = RandomMulliganRule().Invoke(player.Choice.Choices.Select(p => poGame.getGame().IdEntityDic[p]).ToList());
                return(ChooseTask.Mulligan(player, mulligan));
            }

            List <PlayerTask> options = poGame.CurrentPlayer.Options();

            int count = 0;

            foreach (PlayerTask option in options)
            {
                count++;
                Console.WriteLine("[" + count.ToString() + "] " + option);
            }

            bool success = false;
            int  choice  = 0;

            while (!success)
            {
                string input = Console.ReadLine();
                choice = int.Parse(input);
                if (choice > 0 && choice <= count)
                {
                    success = true;
                }
                else
                {
                    Console.WriteLine("Please enter a number for the option you choose.");
                }
            }

            return(options[choice - 1]);
        }