During the quarantine, I've been sharpening my tactics and studying endgame theory, but lately I've been wanting to learn some openings. In particular, I wanted to get a little practice with some crazy openings that the streamers [1] I've been watching play before trying them out in actual games.<p>So I built this CLI tool. The intended use case is to 1) download the games of a chess player from a website like openingtree.com, 2) run the program on the fetched PGN file to generate an opening repertoire, and 3) import the output into a study tool like lichess or chessable.<p>This has been my first foray into Rust and I learnt a lot while coding. One thing that particularly gave me trouble was modeling the opening tree given how stringent Rust's requirements are when it comes to lifetimes & mutability. Fortunately I found out about arena allocation [2] in a blog post [3] by Niko Matsakis, a Rust core dev, and inspired by the approach he advocates I was able to implement it in a fairly straightforward way. Although pruning the opening tree results in a leak as a consequence of this impl, I don't think it causes any safety issues in this case.<p>[1]: Shout out to Eric Rosen, Jonathan Schrantz & the chessbrahs.
[2]: <a href="https://en.wikipedia.org/wiki/Region-based_memory_management" rel="nofollow">https://en.wikipedia.org/wiki/Region-based_memory_management</a>
[3]: <a href="http://smallcultfollowing.com/babysteps/blog/2015/04/06/modeling-graphs-in-rust-using-vector-indices/" rel="nofollow">http://smallcultfollowing.com/babysteps/blog/2015/04/06/mode...</a>