| 1 |
Gaviota Tablebases Probing Code API |
| 2 |
Copyright (c) 2010-2011 Miguel A. Ballicora |
| 3 |
----------------------------------------------------------------------------- |
| 4 |
|
| 5 |
This software provides C code to probe the Gaviota Endgame Tablebases. |
| 6 |
It is released under then X11 ("MIT") license (see license.txt). |
| 7 |
|
| 8 |
This API (Application Programming Interface) is designed to be as portable |
| 9 |
as possible. Functions could be called from Linux or Windows. |
| 10 |
Most likely it will work in other operating systems but that has not been |
| 11 |
tested. This API is a beta version and as such, it is not guaranteed any |
| 12 |
type of backward compatibility or to remain untouched, at least until |
| 13 |
version 1.0 is released. |
| 14 |
|
| 15 |
A very small set of tablebase files is included in this distribution |
| 16 |
for testing purposes (only 3 pieces). They are compressed with four |
| 17 |
different compression schemes. For a more complete set, please download |
| 18 |
Gaviota from |
| 19 |
|
| 20 |
http://sites.google.com/site/gaviotachessengine/ |
| 21 |
|
| 22 |
and generate the 4 and 5 piece tablebases. Instructions how to generate |
| 23 |
and compressed them are in the website. More information can always be found: |
| 24 |
|
| 25 |
http://sites.google.com/site/gaviotachessengine/Home/endgame-tablebases-1 |
| 26 |
|
| 27 |
Alternatively, already compressed tablebase files (ready to go!) can be |
| 28 |
downloaded from |
| 29 |
|
| 30 |
http://www.olympuschess.com/egtb/gaviota/ (Many thanks to Josh Shriver) |
| 31 |
|
| 32 |
"tbprobe" is distributed here as a tablebase probing example. The current API |
| 33 |
is relatively "low level" to optimize performance. We hope the small program |
| 34 |
tbprobe is self explanatory. A thorough and detailed documentation may be |
| 35 |
released later. However, it seems that everybody who attempted to implement |
| 36 |
this probing code was successful relatively easy. |
| 37 |
|
| 38 |
We plan to support an interface with a FEN notation; thus, it is expected |
| 39 |
that some other functions maybe added to this API. |
| 40 |
|
| 41 |
Four different types of compression are included. It is possible that in the |
| 42 |
future some other compression schemes could be provided, but only if they |
| 43 |
represent a serious improvement in speed or memory size. To maximize |
| 44 |
backward compatibility between versions of programs and TBs, it is strongly |
| 45 |
recommended that engine developers always support at least scheme 4 (tb_CP4), |
| 46 |
which is considered the default at this point. For that reason, it is |
| 47 |
suggested that testers always have a set of TBs compressed with scheme 4. |
| 48 |
|
| 49 |
This API is designed to be multithreading friendly. Regions where different |
| 50 |
threads could access data from this API were protected with a mutex to avoid |
| 51 |
problems. |
| 52 |
|
| 53 |
-------------------------- How to use this API ------------------------------ |
| 54 |
|
| 55 |
To include this code in any engine or GUI, the following files should be |
| 56 |
compiled and linked: |
| 57 |
|
| 58 |
gtb-probe.c |
| 59 |
gtb-dec.c |
| 60 |
gtb-att.c |
| 61 |
sysport/sysport.c |
| 62 |
compression/wrap.c |
| 63 |
compression/huffman/hzip.c |
| 64 |
compression/liblzf/lzf_c.c |
| 65 |
compression/liblzf/lzf_d.c |
| 66 |
compression/zlib/zcompress.c |
| 67 |
compression/zlib/uncompr.c |
| 68 |
compression/zlib/inflate.c |
| 69 |
compression/zlib/deflate.c |
| 70 |
compression/zlib/adler32.c |
| 71 |
compression/zlib/crc32.c |
| 72 |
compression/zlib/infback.c |
| 73 |
compression/zlib/inffast.c |
| 74 |
compression/zlib/inftrees.c |
| 75 |
compression/zlib/trees.c |
| 76 |
compression/zlib/zutil.c |
| 77 |
compression/lzma/LzmaEnc.c |
| 78 |
compression/lzma/LzmaDec.c |
| 79 |
compression/lzma/Alloc.c |
| 80 |
compression/lzma/LzFind.c |
| 81 |
compression/lzma/Lzma86Enc.c |
| 82 |
compression/lzma/Lzma86Dec.c |
| 83 |
compression/lzma/Bra86.c |
| 84 |
|
| 85 |
The following files will be "included" |
| 86 |
gtb-probe.h |
| 87 |
gtb-dec.h |
| 88 |
gtb-att.h |
| 89 |
gtb-types.h |
| 90 |
|
| 91 |
plus all the *.h files in the folders, so set the proper -I flags: |
| 92 |
sysport/ |
| 93 |
compression/ |
| 94 |
compression/huffman/ |
| 95 |
compression/liblzf/ |
| 96 |
compression/zlib/ |
| 97 |
compression/lzma/ |
| 98 |
|
| 99 |
The following libraries should be linked in Linux |
| 100 |
-lpthread |
| 101 |
-lm |
| 102 |
|
| 103 |
In Windows, the appropriate MT (multithreaded library should be linked too) |
| 104 |
|
| 105 |
These switches should be set in the compiler |
| 106 |
-D NDEBUG |
| 107 |
-D Z_PREFIX |
| 108 |
|
| 109 |
The first one removes the assert code, and the second |
| 110 |
one makes sure that there is no collision between some names in the |
| 111 |
zlib library and names in other compression libraries. |
| 112 |
|
| 113 |
-------------------------- COMPILATION EXAMPLE ------------------------------ |
| 114 |
|
| 115 |
The file compile.sh is an example of how tbprobe can be |
| 116 |
compiled in Linux using gcc. |
| 117 |
|
| 118 |
Rakefile.rb is the ruby version of Makefile. You have to install 'rake' |
| 119 |
to execute it. This is what I use but you don't have to. It is provided |
| 120 |
out of laziness. I should probably remove it. |
| 121 |
|
| 122 |
------------------ COMPILING A STATIC LIBRARY (optional) -------------------- |
| 123 |
|
| 124 |
Aaron Becker wrote a Makefile to compile a static library --> libgtb.a |
| 125 |
I just applied this modification from his fork. |
| 126 |
For now, this for Linux only. Type 'make' to compile it. |
| 127 |
Some people may find this approach more convenient since the library |
| 128 |
has to be compiled only once. Of course, this library needs to be included |
| 129 |
at linking time, when you compile your own program |
| 130 |
|
| 131 |
---------------------------- For UCI Authors -------------------------------- |
| 132 |
|
| 133 |
Generally, UCI (Universal Chess Interface) GUIs use standard labels for |
| 134 |
Tablebase paths and cache sizes. For instance, NalimovPath and NalimovCache |
| 135 |
are used for the Nalimov tablebases. Therefore, engine authors are strongly |
| 136 |
encouraged (Please!) to follow a common standard to simplify the life of GUI |
| 137 |
developers and users. For that reason, it is suggested to implement as |
| 138 |
parameters: GaviotaTbPath and GaviotaTbCache in their communication with a |
| 139 |
UCI graphical user interface. |
| 140 |
|
| 141 |
----------------------------------------------------------------------------- |
| 142 |
|
| 143 |
Good luck with the tablebases! |
| 144 |
|
| 145 |
Miguel |
| 146 |
|
| 147 |
***************************************************************************** |