Show HN: Libpgn – .pgn (chess game records) parser, 2 years later
1 points
2 hours ago
| 0 comments
| github.com
| HN
Hi everyone,

libpgn was on ShowHN 2 years ago (https://news.ycombinator.com/item?id=41442029), I wrote this parser as an attempt to understand FFI (like what raylib does, how can other language understand C code?). It turns out there's no other C99 implementation for a .pgn parser (aside for some C++ library), which was a golden opportunity.

What can you do with libpgn?

    - Make a replay system (barebone in Ada: https://github.com/user-attachments/assets/8d30cdc3-7692-45bc-b313-db19e981529c).
    - Save a game state, so you can reproduce the same state if it crashes.
    - Chess game/opening/tutorial database.
    - Feed neural networks to play chess from .pgn record?
    - And, more ..?
I recently compared libpgn with `python-chess` (RegEx), and it shows to be 66x times faster (https://gist.github.com/fwttnnn/ad0f60d37ef9e8fefdd0c8664f18...).

Also, libpgn was originally GPLv2 (https://news.ycombinator.com/item?id=41442199). Since this was a library, I just decided to switch into ISC.

No one has commented on this post.