Skip to content

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

@maximus232

Description

@maximus232

"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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions