niklasf / chessops

Chess and chess variant rules and operations in TypeScript
https://niklasf.github.io/chessops/
GNU General Public License v3.0
114 stars 34 forks source link

PGN parsing and writing #36

Closed VincentCordobes closed 2 years ago

VincentCordobes commented 2 years ago

Is it something that could be part of this library ?

Btw thank you for this awesome lib! :)

niklasf commented 2 years ago

Thanks.

Yes, absolutely, PGN handling is definitely within the scope of this library. To help make some decisions about data structures, can you please describe what kind of operations you would be doing with parsed games?

VincentCordobes commented 2 years ago

Currently, I'm building a tree that looks like:

type Node = {
  ply: Ply
  fen: Fen
  san: San
  children: Node[]
}

Basically I would:

I've seen your work for python and this looks perfect. Let me know if I can help ;)

jtwires commented 2 years ago

+1, a visitor interface like your python-chess would be fantastic

niklasf commented 2 years ago

I finished a basic implementation. Still needs more testing, documentation, and maybe some convenience methods/functions ...