-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
dump / restore game state to / from json. #21
Comments
@macdja38 - thank you for this issue report! I did something similar to this for a The code implementation is here: https://github.com/brozeph/stdlib-chess/blob/master/f/game/index.js Effectively, I maintained state for the moves using a base64 encoded string... but I like the idea of being able to quickly and easily serialize/deserialize as JSON. I'll spend some time on this as time allows - it may take me a hot minute to get to it, though. |
@Piterden - thank you for sharing! It looks like you're saving each move into a table and then restoring the board by re-applying each move individually. This is effectively what I did in the stdlib implementation. An alternative, I recently noticed, which I forgot about in my original reply on this issue thread, that there is a way to load a game from a move history: https://github.com/brozeph/node-chess/blob/master/src/game.js#L86. One possibility might be to serialize the move history as JSON ( |
Unfortunately, for my case the |
Should we keep this issue open, or does the FEN load address this need? |
This is a feature request
It would be nice to see a simple api to dump game state to json and restore it. Something like
This could be used to save games in a database or create save/restore points.
The text was updated successfully, but these errors were encountered: