I’ve decided to start fresh, and completely rewrite Prophet from the ground up for the third time. The first iteration of Prophet was written around 2000. Prophet2 was started in 2007. Prophet3 was started in 2011 (see Shall we play a game?) but didn’t really get completed for several years after that. Now, in 2019, it’s time again.
There are numerous reasons I’ve decided to start over. In short though, I’ve been doing some C coding professionally lately, and when I look at the Prophet3 codebase (which was started at a time I had only done C as a hobby), well, I know I can do better.
- Use pure C. Prophet3 is “nearly C” anyway. It is not an object oriented program.
- Modularize the codebase. Group source files into directories according to functionality. E.g. movegen, eval, search, etc.
- Break the code down into more source files that are more focused in nature.
- Make better use of static functions.
- Make better use of the const qualifier.
- Improve the documentation. Each function should have at least a brief description of its purpose, a listing of arguments and return value.
- Improve testing coverage. In general Prophet3 is well tested, but there are some areas the coverage could improve.
- Use a proper test harness, e.g. GoogleTest or the like. The release binary should not contain the test code. Prophet3 uses assertions exclusively, and all the test code is built into the binary (even though it can’t be executed when compiled with the NDEBUG flag).
- Make use of memory leak detectors such as Valgrind on each release.
- Produce a static library containing the move generation, evaluation, and search related functions. It will not include the opening book related code or the Xboard protocol related code. The intent is to modularize the core functionality for inclusion in other projects.
- Retire SQLite. It never felt like a relational database was a good fit for the opening book. Replace with a Key-Value store type database, possibly LMDB.
If you are interested in having a look or just tracking the progress, the Github repo is https://github.com/jswaff/prophet4.