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

Display Game as PGN #69

Open
yzoug opened this issue Dec 27, 2021 · 0 comments
Open

Display Game as PGN #69

yzoug opened this issue Dec 27, 2021 · 0 comments

Comments

@yzoug
Copy link

yzoug commented Dec 27, 2021

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

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