Skip to content

Display Game as PGN #69

@yzoug

Description

@yzoug

Hello,

To ease the task of analysing a game (after it is played using this crate), displaying a Game using PGN could be interesting, so that it can be plugged into the Lichess analysis board for example (https://lichess.org/analysis).

I have started working on this but I am a very new Rust dev so mistakes are bound to be made. Would this project still be interested in a PR for this?

Since the Game struct is already not as efficient as Board and not recommended for chess engines, I went for something very simple, but not so efficient: implementing Display for the Game struct, iterating over all the actions, ignoring every MakeMove except ChessMove, applying the move in a Board, copied from starting_pos (so that I can easily get the Piece that is in each Square from a ChessMove), and with this creating the full PGN string.

If another approach should be preferred, I would be interested in details and I'll try to do it!

Thanks a lot,
yzoug

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