public void GetPossibleFirstMovesForBlack() { var board = new ChessBoardState(); board.TryMakeMove(5); // White moves a pawn. var expectedMoves = new List <string> { "Pa7-a5", "Pa7-a6", "Pb7-b5", "Pb7-b6", "Pc7-c5", "Pc7-c6", "Pd7-d5", "Pd7-d6", "Pe7-e5", "Pe7-e6", "Pf7-f5", "Pf7-f6", "Pg7-g5", "Pg7-g6", "Ph7-h5", "Ph7-h6", "Nb8-a6", "Nb8-c6", "Ng8-f6", "Ng8-h6" }; CheckPossibleMoves(board, expectedMoves); }
public void GetMoves_ScholarsMate() { var board = new ChessBoardState(); PrintBoardState(board); board.TryMakeMove(13); // Pe2-e4 PrintBoardState(board); board.TryMakeMove(8); // .. Pe7-e5 PrintBoardState(board); board.TryMakeMove(9); // Bf1-c4 PrintBoardState(board); board.TryMakeMove(15); // .. Nb8-c6 PrintBoardState(board); board.TryMakeMove(5); // Qd1-h5 PrintBoardState(board); board.TryMakeMove(25); // .. Ng8-f6 PrintBoardState(board); board.TryMakeMove(41); // Qh5-f7++ PrintBoardState(board); var expectedMoves = new List <string> { }; CheckPossibleMoves(board, expectedMoves); var isGameOver = board.IsGameOver(out int gameResult); Assert.IsTrue(isGameOver, "The game should be over, but it's not."); Assert.AreEqual(1, gameResult, $"The game should be a White win, but it's not. Expected result of 1 (White wins), but result was {gameResult}."); }