Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

San Ambiguity() bug (issue with Pinner pieces) #65

Open
maximus232 opened this issue May 22, 2023 · 0 comments
Open

San Ambiguity() bug (issue with Pinner pieces) #65

maximus232 opened this issue May 22, 2023 · 0 comments

Comments

@maximus232
Copy link

"Re1" and "Ree1" are generated as san moves in the following test. Should be "Rae1" and "Ree1". I'm pretty sure this is related to pinned pieces, it thinks the Rook on e5 is pinned when generating Disambiguations. (It is actually a pinner of the Black king)

[Fact]
public void RookSanAmbiguity_a1e5()
{
// Tests rook ambiguity notation for white rooks @ a1 and e5.
const string fen = "4k2r/r3bppp/p1p5/3pR3/Pp1P1B2/7P/1PP2PP1/R5K1 w k - 0 37";
const MoveNotations notation = MoveNotations.San;
var expectedNotations = new[] { "Rae1", "Ree1" };

    var game = GameFactory.Create(fen);

    var sideToMove = game.Pos.SideToMove;
    var targetPiece = PieceTypes.Rook.MakePiece(sideToMove);

    var moveNotation = MoveNotation.Create(game.Pos);

    var sanMoves = game.Pos
        .GenerateMoves()
        .Select(static em => em.Move)
        .Where(m => game.Pos.GetPiece(m.FromSquare()) == targetPiece)
        .Select(m => moveNotation.ToNotation(notation).Convert(m))
        .ToArray();

    foreach (var notationResult in expectedNotations)
        Assert.Contains(sanMoves, s => s == notationResult);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant