brozeph / node-chess

A simple node.js library for parsing and validating chess board position with an algebraic move parser
https://brozeph.github.io/node-chess
MIT License
142 stars 31 forks source link

Are RAVs(Recursive Annotation Variation) in PGN possible? #72

Open coffeeDev98 opened 2 years ago

coffeeDev98 commented 2 years ago

@brozeph Is it possible to create move variations using this package...?

brozeph commented 2 years ago

@coffeeDev98, thank you for your question above... can you explain more about how you'd like this feature to work?

brozeph commented 2 years ago

Found the following resource regarding RAV: http://www.saremba.de/chessgml/standards/pgn/pgn-complete.htm#:~:text=An%20RAV%20(Recursive%20Annotation%20Variation,to%20represent%20an%20alternative%20variation.

Effectively, the important parts:

An RAV (Recursive Annotation Variation) is a sequence of movetext containing
one or more moves enclosed in parentheses.  An RAV is used to represent an
alternative variation.  The alternate move sequence given by an RAV is one that
may be legally played by first unplaying the move that appears immediately
prior to the RAV.  Because the RAV is a recursive construct, it may be nested.

*** The specification for import/export representation of RAV elements needs
further development.

The part that concerns me is the last statement with asterisks... sounds like the spec is not yet complete (plus I'm having a hard time finding much guidance on how to produce the output properly).

Piterden commented 2 years ago

@coffeeDev98 this library is the engine which takes chess moves one by one and shows to you possible moves after each your move. Also, it detects the state of chess game (check, checkmate, repetition, etc.) after each move sequentially and store position of pieces on the board after each too. It is like just a chess board, not AI engine.

In context of a chess game and in its rules there's no way to make move variation trees. Even there's no case for use them.

You'd probably need some PGN-editor

coffeeDev98 commented 2 years ago

@brozeph @Piterden Thanks for the responses! Yes, It is not to be used in a gameplay scenario where the use cases of this package mainly lie in. Was looking to see if it was possible to use this for analytical purposes as well, with a possibility to create variations. There's not much info on the implementation of variations so it's hard to figure how to go through with the implementation and finding a structure, given the infinite possibilities of variations.