Skip to content

Commit

Permalink
Further documentation and coding style on TB code
Browse files Browse the repository at this point in the history
This patch adds some documentation and code cleanup to tablebase code.

It took me some time to understand the relation among the differrent
structs, although I have rewrote them fully in the past. So I wrote
some detailed documentation to avoid the same efforts for future readers.

Also noteworthy is the use a standard hash table implementation with a
more efficient 1D array instead of a 2D array. This reduces the average
lookup steps of 90% (from 343 to 38 in a bench 128 1 16 run) and reduces
also the table from 5K to 4K
entries.

I have tested on 5-men and no functional and no slowdown reported. It
should be verified on 6-men that the new hash does not overflow. It is
enough to run ./stockfish with 6-men available: if it does not assert at
startup it means everything is ok with 6-men too.

EDIT: verified for 6-men tablebase by Jörg Oster. Thanks!

No functional change.
  • Loading branch information
mcostalba authored and snicolet committed Apr 12, 2018
1 parent 62619fa commit 6413d9b
Show file tree
Hide file tree
Showing 2 changed files with 266 additions and 243 deletions.
2 changes: 1 addition & 1 deletion src/main.cpp
Expand Up @@ -43,7 +43,7 @@ int main(int argc, char* argv[]) {
Bitbases::init();
Search::init();
Pawns::init();
Tablebases::init(Options["SyzygyPath"]);
Tablebases::init(Options["SyzygyPath"]); // After Bitboards are set
TT.resize(Options["Hash"]);
Threads.set(Options["Threads"]);
Search::clear(); // After threads are up
Expand Down

0 comments on commit 6413d9b

Please sign in to comment.