This is an API for reading data from the antichess endgame tablebase with DTW (Depth To Win) metric.
The API represents 3 functions:
- antichess_tb_init should be called once at the very beginning. If initialisation is successful, the function returns 0.
- antichess_tb_add_path should be called once before probing, specifying the path to the folder where all tablebase files are located. If all files are successfully loaded, the function returns 0.
- antichess_tb_probe_dtw is used for probing antichess positions:
- white_squares/black_squares should have values from 0 (a1), 1 (b1), etc. to 63 (h8).
- white_pieces/black_pieces should have values from 1 to 6 for PNBRQK (only the least significant three bits are taken into account).
- num_white_pieces/num_black_pieces should be 1+1, 1+2, 1+3, 2+1, 2+2, or 3+1.
- ep_square specifies the en passant target square (16...23 or 40...47) or any other value outside these ranges if there are none. In case of an error, the function returns a negative value indicating the error code. If one side wins, the function returns 0. In case of a cursed win or a blessed loss (because of the 50-move rule), the function returns 1. In case of a draw, the function returns 2. If there are no errors, the function sets the value of dtw. The absolute value of dtw is equal to the number of plies before the win. The value is positive if the side to move wins, or negative if the side to move loses. dtw = 0 if it is a draw or the side to move has no legal moves.
This code is released under the GPLv3+ license.
The following code is used in the program:
- Syzygy (modified)
- Multi-Variant Stockfish (modified)
- Dictzip from dictd 1.12.1 with Tvangeste's tweaks (modified)
- zlib 1.3.0.1