Пример #1
0
        public void DetermineWinnerTest()
        {
            // Arrange
            Game testGame = new Game();

            for (int i = 0; i < 4; i++)
            {
                testGame.mainBoards[0].SquaresOnBoard[i].HasX = false;
            }
            // Act
            PlayerName result = EndGame.DetermineWinner(testGame.mainBoards);

            // Assert
            Assert.AreEqual(PlayerName.O, result);
        }
Пример #2
0
        /// <summary>
        /// Creates series of turns until end game condition is met.
        /// </summary>

        public void RunGame()

        {
            while (this.GameIsDone == false)
            {
                TakeTurn(currentPlayer);
                if (EndGame.BoardHasOnlyXsOrOs(mainBoards))
                {
                    Console.WriteLine(EndGame.DetermineWinner(mainBoards) + " is the winner!");
                    GameIsDone = true;
                }
                if (currentPlayer == PlayerX)
                {
                    currentPlayer = PlayerO;
                }
                else
                {
                    currentPlayer = PlayerX;
                }
            }
        }