public void KingJumpsTest(Player player) { var board = TestUtils.GetEmptyBoard(5); board[2, 2] = player.ToKing(); PlacePiecesToJump(player, board); var nextMove = new NextMovesGenerator(board, player).GenerateNextMoves(); Assert.AreEqual(4, nextMove.Count); var expectedBoard = TestUtils.GetEmptyBoard(5); PlacePiecesToJump(player, expectedBoard); expectedBoard[0, 0] = player.ToKing(); expectedBoard[1, 1] = CheckerPiece.Empty; Assert.IsTrue(nextMove.Contains(expectedBoard), "Didn't get board" + Environment.NewLine + expectedBoard.ToState(player)); expectedBoard = TestUtils.GetEmptyBoard(5); PlacePiecesToJump(player, expectedBoard); expectedBoard[4, 4] = player.ToKing(); expectedBoard[3, 3] = CheckerPiece.Empty; Assert.IsTrue(nextMove.Contains(expectedBoard), "Didn't get board" + Environment.NewLine + expectedBoard.ToState(player)); expectedBoard = TestUtils.GetEmptyBoard(5); PlacePiecesToJump(player, expectedBoard); expectedBoard[0, 4] = player.ToKing(); expectedBoard[1, 3] = CheckerPiece.Empty; Assert.IsTrue(nextMove.Contains(expectedBoard), "Didn't get board" + Environment.NewLine + expectedBoard.ToState(player)); expectedBoard = TestUtils.GetEmptyBoard(5); PlacePiecesToJump(player, expectedBoard); expectedBoard[4, 0] = player.ToKing(); expectedBoard[3, 1] = CheckerPiece.Empty; Assert.IsTrue(nextMove.Contains(expectedBoard), "Didn't get board" + Environment.NewLine + expectedBoard.ToState(player)); }
public void KingMovesTest(Player player) { var board = TestUtils.GetEmptyBoard(3); board[1, 1] = player.ToKing(); var nextMove = new NextMovesGenerator(board, player).GenerateNextMoves(); Assert.AreEqual(4, nextMove.Count); var expectedBoard = TestUtils.GetEmptyBoard(3); expectedBoard[0, 0] = player.ToKing(); Assert.IsTrue(nextMove.Contains(expectedBoard), "Didn't get board" + Environment.NewLine + expectedBoard); expectedBoard = TestUtils.GetEmptyBoard(3); expectedBoard[2, 2] = player.ToKing(); Assert.IsTrue(nextMove.Contains(expectedBoard), "Didn't get board" + Environment.NewLine + expectedBoard); expectedBoard = TestUtils.GetEmptyBoard(3); expectedBoard[0, 2] = player.ToKing(); Assert.IsTrue(nextMove.Contains(expectedBoard), "Didn't get board" + Environment.NewLine + expectedBoard); expectedBoard = TestUtils.GetEmptyBoard(3); expectedBoard[2, 0] = player.ToKing(); Assert.IsTrue(nextMove.Contains(expectedBoard), "Didn't get board" + Environment.NewLine + expectedBoard); }
public void MaxCheckerDontMoveBack() { var board = TestUtils.GetEmptyBoard(2); board[1, 1] = CheckerPiece.MaxChecker; var nextMove = new NextMovesGenerator(board, Player.Max).GenerateNextMoves(); Assert.AreEqual(0, nextMove.Count); }
public void MaxCantJumpBackTest() { var board = TestUtils.GetEmptyBoard(3); board[2, 2] = CheckerPiece.MaxChecker; board[1, 1] = CheckerPiece.MinChecker; var nextMove = new NextMovesGenerator(board, Player.Max).GenerateNextMoves(); Assert.AreEqual(0, nextMove.Count); }
public void MaxMoveGetsKingTest() { var board = TestUtils.GetEmptyBoard(2); board[0, 0] = CheckerPiece.MaxChecker; var nextMove = new NextMovesGenerator(board, Player.Max).GenerateNextMoves(); var expectedBoard = TestUtils.GetEmptyBoard(2); expectedBoard[1, 1] = CheckerPiece.MaxKing; Assert.IsTrue(TestUtils.AreEquale(expectedBoard, nextMove[0].GetBoard()), "Got board" + Environment.NewLine + nextMove[0]); }
public void MinMoveTest() { var board = TestUtils.GetEmptyBoard(3); board[2, 2] = CheckerPiece.MinChecker; var nextMove = new NextMovesGenerator(board, Player.Min).GenerateNextMoves(); var expectedBoard = TestUtils.GetEmptyBoard(3); expectedBoard[1, 1] = CheckerPiece.MinChecker; Assert.IsTrue(TestUtils.AreEquale(expectedBoard, nextMove[0].GetBoard()), "Got board" + Environment.NewLine + nextMove[0]); }
public void MaxDoubleJumpTest() { var board = TestUtils.GetEmptyBoard(5); board[0, 0] = CheckerPiece.MaxChecker; board[1, 1] = CheckerPiece.MinChecker; board[3, 1] = CheckerPiece.MinKing; var nextMove = new NextMovesGenerator(board, Player.Max).GenerateNextMoves(); var expectedBoard1 = TestUtils.GetEmptyBoard(5); expectedBoard1[2, 2] = CheckerPiece.MaxChecker; expectedBoard1[3, 1] = CheckerPiece.MinKing; Assert.IsTrue(TestUtils.AreEquale(expectedBoard1, nextMove[0].GetBoard()), "Got board" + Environment.NewLine + nextMove[0]); var expectedBoard2 = TestUtils.GetEmptyBoard(5); expectedBoard2[4, 0] = CheckerPiece.MaxKing; Assert.IsTrue(TestUtils.AreEquale(expectedBoard2, nextMove[1].GetBoard()), "Got board" + Environment.NewLine + nextMove[1]); }