コード例 #1
0
        static void Main(string[] args)
        {
            Grid        gameGrid = new Grid();
            GameControl Game     = new GameControl(gameGrid);
            Human       human    = new Human("X");
            Computer    computer = new Computer("O", gameGrid);
            //Human human2 = new Human("O");

            Queue <Player> Turn = new Queue <Player>();

            Turn.Enqueue(human);
            //Turn.Enqueue(human2);
            Turn.Enqueue(computer);

            while (Game.isRunning == true)
            {
                if (Turn.Count == 0)
                {
                    Turn.Enqueue(human);
                    //Turn.Enqueue(human2);
                    Turn.Enqueue(computer);
                }

                var activePlayer = Turn.Dequeue();

                while (!Game.CheckInput(activePlayer.getChoice))
                {
                    activePlayer.Input();
                }

                gameGrid.UpdateGrid(Game.getGridSelection, activePlayer.getPlayerMarker);


                gameGrid.PrintGrid();
                Console.WriteLine(activePlayer.getChoice);

                if (Game.CheckCondition())
                {
                    Game.isRunning = false;
                }
                else if (human.getChoice == "Quit")
                {
                    Game.isRunning = false;
                }
            }

            Console.ReadLine();
        }