Damn, I just got hooked on this and was hoping someone on here would have already done a line by line translation of how this is possible. Time to brush up on common ai techniques (or perhaps the old dark arts) either way this is both very humbling and inspiring.
(Scanned the Oscar Toledo github/site and found this for anyone else interested https://nanochess.org/chess4.html)