/// <summary> /// Gets board selection from user. If illegal, returns false. If legal, assigns as CurrentBoard. /// </summary> private bool GetBoardFromUser() { Console.Write($"{CurrentPlayer}, select a board to make your {this.currentTurnType} move on (or type \"rules\" to see rules): "); string selectedBoardInput = Console.ReadLine(); if (BoardLogic.IsValidBoard(selectedBoardInput) == false) { return(false); } this.CurrentBoard = this.MainBoards[int.Parse(selectedBoardInput) - 1]; if (this.TurnIsPassive && BoardLogic.BoardIsHomeBoard(CurrentPlayer, this.CurrentBoard.BoardNumber) == false) { Console.WriteLine("Passive move must be made on a home board. Press enter to continue."); Console.ReadLine(); return(false); } if (!this.TurnIsPassive) { if (BoardLogic.BoardIsLegalForAggressiveMove(CurrentPlayer.LastMoveMade, CurrentBoard.BoardNumber) == false) { Console.WriteLine("Aggressive move must be made on a board of different color than your passive move."); Console.ReadLine(); return(false); } } return(true); }
public void BoardIsHomeBoardTest() { // Arrange Board testBoard = new Board(1); Player testPlayer = new Player(PlayerName.X, new int[] { 1, 2 }); // Act bool positiveResult = BoardLogic.BoardIsHomeBoard(testPlayer, 1); bool negativeResult = BoardLogic.BoardIsHomeBoard(testPlayer, 3); // Assert Assert.IsTrue(positiveResult); Assert.IsFalse(negativeResult); }