Probing example code or data structure

Endgame analysis using tablebases, EGTB generation, exchange, sharing, discussions, etc..
Post Reply
forsslund
Posts: 1
Joined: Sat Jan 09, 2010 10:20 pm
Sign-up code: 10159

Probing example code or data structure

Post by forsslund »

Hi,
I'm new to interfacing with the standard EGTB files, and I have tried to find information on how they (Nalimove) actually are structured but could not find any good source on that.
What i'm actually looking for as a start is a command line interface to just probe a (one) position. Maybe that is possible through scid or crafty?
If it is proprietary, are there any other emerging open file format that has good compression that we should use?
dann corbit
Posts: 16
Joined: Fri Jan 25, 2008 9:10 am

Re: Probing example code or data structure

Post by dann corbit »

To use the Nalimov tablebase files, you have to get permission first.
It is also problematic as far as licence (e.g. it cannot be used in GPL projects, for example).

Miguel Ballicora's format is the wave of the future. It will be released with a licence that everyone can use. Every other format is a pest (for some reason)*.

* as far as I am concerned
IMO-YMMV
User avatar
Ed Trice
Posts: 58
Joined: Thu Oct 28, 2010 1:13 am
Sign-up code: 10159
Location: Henlopen Acres, Delaware
Contact:

Re: Probing example code or data structure

Post by Ed Trice »

forsslund wrote:Hi,
I'm new to interfacing with the standard EGTB files, and I have tried to find information on how they (Nalimove) actually are structured but could not find any good source on that.
What i'm actually looking for as a start is a command line interface to just probe a (one) position. Maybe that is possible through scid or crafty?
If it is proprietary, are there any other emerging open file format that has good compression that we should use?
There are command line interface prefixes to set up a FEN position, including side to move and so on, and then query the database to get the distance to mate info (or draw).

I can look them up for you and report back.
5.0 Ghz Intel Gulftown Supercomputers
http://www.liquidnitrogenoverclocking.com
User avatar
Ed Trice
Posts: 58
Joined: Thu Oct 28, 2010 1:13 am
Sign-up code: 10159
Location: Henlopen Acres, Delaware
Contact:

Re: Probing example code or data structure

Post by Ed Trice »

Ok here is what I found.

1. Locate a copy of the tbgen program that generates any tablebases using his format.
2. Say you are examining king + rook + pawn vs. king + rook; make sure you have that file in the same directory as the executable.
3. Maybe you need to "hunt" for a few positions with a certain DTW. The longest is 74 moves in that endgame, so you type in:

Code: Select all

tbgen -w+74 krpkr
...into the console app, and it will spit out:

Code: Select all

Scanning krpkr wtm for win in 74

k7/8/8/8/8/4R3/6P1/1K5r w - -

33 positions found
You can save the FEN positions to a file for later examination by a program with a GUI that can probe the tablebases, or do it the hard way with the command line interface.

There are also many other handy features embedded into the tbgen program.

For what positions of the white king can black to move hold the draw? It seems like a complex question, and one you might not expect the program to be able to handle.

But you can get the answer from a position fragment (white king missing) like this:

Code: Select all

8 R . . . . . . .
7 . . . . . . k .
6 P . . . . . . .
5 . . . . . . . .
4 . . . . . . . .
3 . . . . . . . .
2 . . . . . . . .
1 r . . . . . . .
The tbgen program can output a "drawing zone" with this command:

Code: Select all

tbgen -r b bd "kg7 ra1 Ra8 Pa6 zone(K)" krpkr
It will then spit out this:

Code: Select all

8 . . . . . . . .
7 . . . . . . . .
6 . . . . 1 . . .
5 . . . . . 1 1 1
4 . . . . . 1 1 1
3 . . . . 1 1 1 1
2 . . . 1 1 1 1 1
1 . . . . . . . .
All of the positions of the white king where black to move can draw are marked by a number 1.
5.0 Ghz Intel Gulftown Supercomputers
http://www.liquidnitrogenoverclocking.com
Post Reply