Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
99 | pmbaty | 1 | Gaviota Tablebases Probing Code API |
2 | Copyright (c) 2010 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 more complete and detailed documentation may be |
||
35 | released later. |
||
36 | |||
37 | We plan to support an interface with a FEN notation; thus, it is expected |
||
38 | that some other functions maybe added to this API. |
||
39 | |||
40 | Four different types of compression are included. It is possible that in the |
||
41 | future some other compression schemes could be provided, but only if they |
||
42 | represent a serious improvement in speed or memory size. To maximize |
||
43 | backward compatibility between versions of programs and TBs, it is strongly |
||
44 | recommended that engine developers always support at least scheme 4 (tb_CP4), |
||
45 | which is considered the default at this point. For that reason, it is |
||
46 | suggested that testers always have a set of TBs compressed with scheme 4. |
||
47 | |||
48 | This API is designed to be multithreading friendly. Regions where different |
||
49 | threads could access data from this API were protected with a mutex to avoid |
||
50 | problems. |
||
51 | |||
52 | -------------------------- How to use this API ------------------------------ |
||
53 | |||
54 | To include this code in any engine or GUI, the following files should be |
||
55 | compiled and linked: |
||
56 | |||
57 | gtb-probe.c |
||
58 | gtb-dec.c |
||
59 | gtb-att.c |
||
60 | sysport/sysport.c |
||
61 | compression/wrap.c |
||
62 | compression/huffman/hzip.c |
||
63 | compression/liblzf/lzf_c.c |
||
64 | compression/liblzf/lzf_d.c |
||
65 | compression/zlib/zcompress.c |
||
66 | compression/zlib/uncompr.c |
||
67 | compression/zlib/inflate.c |
||
68 | compression/zlib/deflate.c |
||
69 | compression/zlib/adler32.c |
||
70 | compression/zlib/crc32.c |
||
71 | compression/zlib/infback.c |
||
72 | compression/zlib/inffast.c |
||
73 | compression/zlib/inftrees.c |
||
74 | compression/zlib/trees.c |
||
75 | compression/zlib/zutil.c |
||
76 | compression/lzma/LzmaEnc.c |
||
77 | compression/lzma/LzmaDec.c |
||
78 | compression/lzma/Alloc.c |
||
79 | compression/lzma/LzFind.c |
||
80 | compression/lzma/Lzma86Enc.c |
||
81 | compression/lzma/Lzma86Dec.c |
||
82 | compression/lzma/Bra86.c |
||
83 | |||
84 | The following files will be "included" |
||
85 | gtb-probe.h |
||
86 | gtb-dec.h |
||
87 | gtb-att.h |
||
88 | gtb-types.h |
||
89 | |||
90 | plus all the *.h files in the folders, so set the proper -I flags: |
||
91 | sysport/ |
||
92 | compression/ |
||
93 | compression/huffman/ |
||
94 | compression/liblzf/ |
||
95 | compression/zlib/ |
||
96 | compression/lzma/ |
||
97 | |||
98 | The following libraries should be linked in Linux |
||
99 | -lpthread |
||
100 | -lm |
||
101 | |||
102 | In Windows, the appropriate MT (multithreaded library should be linked too) |
||
103 | |||
104 | These switches should be set in the compiler |
||
105 | -D NDEBUG |
||
106 | -D Z_PREFIX |
||
107 | |||
108 | The first one removes the assert code, and the second |
||
109 | one makes sure that some names in the zlib library will not |
||
110 | collision with names in other compression libraries. |
||
111 | |||
112 | -------------------------- COMPILATION EXAMPLE ------------------------------ |
||
113 | |||
114 | The file compile.sh is an example of how tbprobe can be |
||
115 | compiled in Linux using gcc. |
||
116 | |||
117 | Rakefile.rb is the ruby version of Makefile. You have to install 'rake' |
||
118 | to execute it. This is what I use but you don't have to. It is provided |
||
119 | out of laziness. I should probably remove it. |
||
120 | |||
121 | ------------------ COMPILING A STATIC LIBRARY (optional) -------------------- |
||
122 | |||
123 | Aaron Becker wrote a Makefile to compile a static library --> libgtb.a |
||
124 | I just applied this modification from his fork. |
||
125 | For now, this for Linux only. Type 'make' to compile it. |
||
126 | Some people may find this approach more convenient since the library |
||
127 | has to be compiled only once. Of course, this library needs to be included |
||
128 | at linking time, when you compile your own program |
||
129 | |||
130 | ---------------------------- For UCI Authors -------------------------------- |
||
131 | |||
132 | Generally, UCI (Universal Chess Interface) GUIs use standard labels for |
||
133 | Tablebase paths and cache sizes. For instance, NalimovPath and NalimovCache |
||
134 | are used for the Nalimov tablebases. Therefore, engine authors are strongly |
||
135 | encouraged (Please!) to follow a common standard to simplify the life of GUI |
||
136 | developers and users. For that reason, it is suggested to implement as |
||
137 | parameters: GaviotaTbPath and GaviotaTbCache in their communication with a |
||
138 | UCI graphical user interface. |
||
139 | |||
140 | ----------------------------------------------------------------------------- |
||
141 | |||
142 | Good luck with the tablebases! |
||
143 | |||
144 | Miguel |
||
145 | |||
146 | ***************************************************************************** |