public void ReturnNextPossibleMovesReturnsNextPossibleValidMovesNormalMove() { // Arrange var startingX = 4; var startingY = 4; var expected = GetDefaultMoveSet(); // Act var actual = _movementHandler.ReturnNextPossibleMoves(startingX, startingY); // Assert actual.Should().BeEquivalentTo(expected); }
public Square GetNextSquareToMoveTo(Square currentSquare) { var allMoves = _movementHandler.ReturnNextPossibleMoves(currentSquare.x, currentSquare.y); var allAllowedMoves = RemoveLandedOnMoves(allMoves); _movementHandler.CountOnwardsMoves(allAllowedMoves); var LowestNumberMoves = allAllowedMoves.Where(x => x.numOnwardMoves != 0).Min(x => x.numOnwardMoves); var potentialMoves = allAllowedMoves.Where(x => x.numOnwardMoves == LowestNumberMoves).ToList(); //If multiple, tiebreak var optimalMove = potentialMoves[0]; if (potentialMoves.Count != 1) { optimalMove = TieBreak(potentialMoves); } var optimalSquare = GetSquare(optimalMove.xMove, optimalMove.yMove); return(optimalSquare); }