Beispiel #1
0
        public void GetMoves_WhitePawn_EnPassant()
        {
            var board = new ChessBoardState();

            board.Clear();
            board.SetSideToMove(ChessColor.White);
            board.SetSpot(5, 1, ChessPiece.WhiteKing);
            board.SetSpot(5, 8, ChessPiece.BlackKing);

            // Black's pawn has doublemoved.
            board.SetSpot(3, 5, ChessPiece.BlackPawn);

            // White has two pawns that could capture it.
            board.SetSpot(2, 5, ChessPiece.WhitePawn);
            board.SetSpot(4, 5, ChessPiece.WhitePawn);

            board.SetEnPassantCaptureSquare(3, 6);

            var expectedMoves = new List <string>
            {
                "Ke1-d1",
                "Ke1-f1",
                "Ke1-d2",
                "Ke1-e2",
                "Ke1-f2",

                "Pb5-b6",
                "Pb5xc6", // En Passant Capture

                "Pd5xc6", // En Passant Capture
                "Pd5-d6"
            };

            CheckPossibleMoves(board, expectedMoves);
        }