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

Added game history viewer feature #200

Merged
merged 7 commits into from
Jul 1, 2023

Conversation

gavin-lb
Copy link
Contributor

  • Added game history viewer feature and several associated methods:
    • viewHistory to view the position at a specific ply
    • stopViewingHistory to return to the present position
    • viewStart to view the starting position
    • viewNext to view the next move when viewing history
    • viewPrevious to view the previous move
  • Some miscellaneous fixes
  • Updated docs
  • Added tests

 - Added optional flag parameter to updateGameState method to configure whether the fen should be updated (so that in cases when the fen doesn't need to be updated or the new fen is already known, the new fen does not need to be unnecessarily calculated and updated).
 - Changed move method to only update the board position when neccessary (ie. in the event of a promotion or en passant capture).
 - Moved move and promotion emits into the move method as these are the only times they should ever be emitted. This means the last move isn't unnecessarily found every time emitEvents is called.
 - Fixed broken putPiece method (previously only added the piece to the chess.js game and did not update the chessground board).
 - Fixed patching of changeTurn to movable.events.after in the event user tries to set it to undefined (previously the BoardApi object was not getting bound to the method, causing an error).
Feature includes several associated methods:
 - viewHistory to view the position at a specific ply
 - stopViewingHistory to return to the present position
 - viewStart to view the starting position
 - viewNext to view the next move when viewing history
 - viewPrevious to view the previous move
Copy link
Owner

@qwerty084 qwerty084 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice feature, thanks for your pr

@qwerty084 qwerty084 merged commit b6e738d into qwerty084:main Jul 1, 2023
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants