public void NoLegalAggressiveMoveTest() { // Arrange Game testGame = new Game(); Move testMove = new Move(testGame.mainBoards[0].SquaresOnBoard[4], testGame.mainBoards[0].SquaresOnBoard[6], testGame.mainBoards[0], PlayerName.X, true); testGame.currentPlayer.LastMoveMade = testMove; // Act bool positiveResult = EndGame.NoLegalAggressiveMove(testGame); testGame.mainBoards[1].SquaresOnBoard[4].HasX = true; bool negativeResult = EndGame.NoLegalAggressiveMove(testGame); // Assert Assert.IsFalse(negativeResult); Assert.IsTrue(positiveResult); }
/// <summary> /// Runs a turn, checks mid-turn for the end game condition of no legal /// aggressive moves remaining after passive move /// </summary> public Turn(Game currentGame) { this.CurrentPlayer = currentGame.currentPlayer; this.MainBoards = currentGame.mainBoards; this.CurrentGame = currentGame; ExecutePassiveTurn(); if (EndGame.NoLegalAggressiveMove(currentGame)) { Console.WriteLine(this.CurrentPlayer.LastMoveMade); Console.WriteLine("There are no legal aggressive moves based on that passive move."); Console.WriteLine(EndGame.DisplayWinMessageForOpponent(CurrentPlayer)); currentGame.GameIsDone = true; } else { ExecuteAggressiveTurn(); } }