Skip to content

.ToEPDString produces ambiguous move representations #840

@Anduin2017

Description

@Anduin2017

I wrote the following code:

public class ChessGame
{
    private readonly Engine _engine;

    public ChessGame()
    {
        var channel = Channel.CreateUnbounded<string>(new UnboundedChannelOptions
        {
            SingleReader = true,
            SingleWriter = true
        });
        _engine = new Engine(channel.Writer);
    }

    public string GetBestMove(string fen)
    {
        _engine.AdjustPosition($"position fen {fen}");
        return _engine.IDDFS(1, 10)
            .BestMove
            .ToEPDString();
    }
}

var fen = "2kr3r/p5p1/2p2P2/5n1p/1p6/1B6/PPP3PP/R1B1Q1K1 b - - 0 20";
var game = new ChessGame();
var best = game.GetBestMove(fen); // Re8

Then I started a game:

1. e4 e5 2. Nf3 d5 3. exd5 Qxd5 4. Nc3 Qe6 5. Bb5+ c6 6. Ba4 b5 7. Bb3 Qf6 8. O-O h5 9. d4 Nd7 10. dxe5 Nxe5 11. Nxe5 Qxe5 12. Re1 Bd6 13. Rxe5+ Bxe5 14. Qe1 f6 15. f4 b4 16. Nd1 Bf5 17. fxe5 O-O-O 18. Ne3 Ne7 19. Nxf5 Nxf5 20. exf6

Game fen is:

2kr3r/p5p1/2p2P2/5n1p/1p6/1B6/PPP3PP/R1B1Q1K1 b - - 0 20

However, in this situation:

Screenshot from 2024-07-02 12-37-55

Engine is responding: Re8.

Re8 here is a conflict move and can't be understood.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions