7-man Syzygy support in Fathom
Posted: Tue Apr 23, 2019 4:55 am
I have pushed a branch with changes to support 7-man tbs, here:
https://github.com/jdart1/Fathom/tree/7man
The approach I took was to take the Cfish code, which supports 7-man TBs, and merge it into Fathom. This is not the only way to do it and maybe not even the easiest, but that's the path I took. The main changes were to strip out the dependencies the Cfish tbprobe.c file had on the rest of Cfish, and to graft into it the simpler board representation, move generation and other chess-related code that was in Fathom. There are a few small macros and definitions imported from Cfish, but not much.
My objectives were to:
1. Preserve the existing Fathom interface.
2. Add methods to the interface to support the Cfish approach of returning an array of moves with scores and ranks for root level DTZ and WDL probes.
3. Enable compilation under C99 and C++ as in the original Fathom. However, now C++11 is required, at least to the extent that "atomic" variable support is not optional.
The code has been restructured a bit - I have put all the move generation stuff and defines related to the chess pieces, colors, etc. in tbchess.c. I considered doing some work to actually make this pluggable so that you could easily substitute in a different move generator implementation if you had one, but I have not done that. tbprobe.c now contains all the probing code. The Cfish code and part of the original Fathom code were unlicensed ("This file may be redistributed and/or modified without restrictions"), but my fork is MIT licensed, including this branch. (The Stockfish tablebase code is much nicer--it is all C++11 and very well commented, but that's GPL and so I have not used any of it).
This branch now passes all the tablebase unit tests I have in the Arasan code, which are not very extensive but cover a number of important corner cases.
By the way, also, it fixes a couple of bugs: one of them was fathom.c failing to display en passant captures correctly. Also, I am pretty sure the main branch of Fathom does not actually work on big-endian architectures but this new code should, although I have not tested in that environment.
However, I don't think it is quite ready for production use, for a couple of reasons:
1. Hasn't yet been tested on non-Linux platforms including Windows.
2. I have done very limited testing with 7-man bases. I don't have storage for a full set.
I am going to do a little more testing and cleanup before merging into the main branch. Feedback/additional testing welcome.
--Jon
https://github.com/jdart1/Fathom/tree/7man
The approach I took was to take the Cfish code, which supports 7-man TBs, and merge it into Fathom. This is not the only way to do it and maybe not even the easiest, but that's the path I took. The main changes were to strip out the dependencies the Cfish tbprobe.c file had on the rest of Cfish, and to graft into it the simpler board representation, move generation and other chess-related code that was in Fathom. There are a few small macros and definitions imported from Cfish, but not much.
My objectives were to:
1. Preserve the existing Fathom interface.
2. Add methods to the interface to support the Cfish approach of returning an array of moves with scores and ranks for root level DTZ and WDL probes.
3. Enable compilation under C99 and C++ as in the original Fathom. However, now C++11 is required, at least to the extent that "atomic" variable support is not optional.
The code has been restructured a bit - I have put all the move generation stuff and defines related to the chess pieces, colors, etc. in tbchess.c. I considered doing some work to actually make this pluggable so that you could easily substitute in a different move generator implementation if you had one, but I have not done that. tbprobe.c now contains all the probing code. The Cfish code and part of the original Fathom code were unlicensed ("This file may be redistributed and/or modified without restrictions"), but my fork is MIT licensed, including this branch. (The Stockfish tablebase code is much nicer--it is all C++11 and very well commented, but that's GPL and so I have not used any of it).
This branch now passes all the tablebase unit tests I have in the Arasan code, which are not very extensive but cover a number of important corner cases.
By the way, also, it fixes a couple of bugs: one of them was fathom.c failing to display en passant captures correctly. Also, I am pretty sure the main branch of Fathom does not actually work on big-endian architectures but this new code should, although I have not tested in that environment.
However, I don't think it is quite ready for production use, for a couple of reasons:
1. Hasn't yet been tested on non-Linux platforms including Windows.
2. I have done very limited testing with 7-man bases. I don't have storage for a full set.
I am going to do a little more testing and cleanup before merging into the main branch. Feedback/additional testing welcome.
--Jon