Computer Chess Club Archives


Search

Terms

Messages

Subject: Proposed interface to C.A.P. data -- Request for feedback...

Author: Dann Corbit

Date: 10:11:05 07/08/99


A C++ program will be written (with a C interface for C programs, DLL's from
BASIC or whatever) which will load the EPD data will the following conditions:

/*
Load the EPD data from disk file to memory data structure.
*/
Function: AsciiLoad(int min_pieces, int min_mating_distance)
min_pieces will load only EPD positions with at least min_pieces on the board.
If min_pieces is 2 or less, it will load all positions.  This should be
especially helpful for people with full EGTB to some particular level.  No sense
loading 5 piece positions if you have a 5 piece TB.
min_mating_distance will load only positions with a known mating distance of at
least that far.  So if you should select 0, then mated positions would be loaded
(ce = -32767).


Here is the binary position structure used by the permanent hash engine.  It is
chosen because it is fairly compact and extremely simple.
/*
192 bits = 24 bytes.

First 64 bits, one bit per square, 0=empty, 1=occupied in EPD/FEN sequence
a8,b8,...a7,b7....

Last 128 bits, 4 bits per pawn/piece, positionally in EPD/FEN sequence.
Unused bits always zero.

Pawn/piece bit patterns as follows:

'0000'  - black king
'1000'  - white king (white to move)
'1111' - white king (black to move)
'0001' - black queen
'1001' - white queen
'0010' - black rook
'1010' - white rook
'0011' - black rook (may castle)
'1011' - white rook (may castle)
'0100' - black knight
'1100' - white knight
'0101' - black bishop
'1110' - white bishop
'0110' - black pawn
'1110' - white pawn
'0111' - en passant pawn
*/
Function: BinaryInquire(position *inquiry_vector, inquiry_count, answer
*answer_vector)
A position is a struct containing 192 bits of data as described above.
The inquiry count tells me how many items are in your vector.  The minimum is 1
and the maximum is 256.
The answer_vector contains structures the following information:
ce
pm
bm (if any)
am (if any)
acd

Function: AsciiInquire(char **ascii_inquiry_vector, inquiry_count, answers
*answer_vector)
Same as above, except that an array of character strings is passed with
positions in standard EPD format.  The binary function is faster, but many
people will only have character strings available.

Function: BinaryInform(position, answer)
Function BinaryInform is used to update the data in memory with a binary
position structure like the above.  If the data does not exist, it is added.  If
it exists, it is added if acd is greater for the new position.  If acd is the
same and pm is different, then it writes an exception record to disk.

Function: AsciiInform(char *ascii_position, answer)
Function AsciiInform is used to update the data in memory with an ASCII EPD
string.  If the data does not exist, it is added.  If it exists, it is added if
acd is greater for the new position.  If acd is the same and pm is different,
then it writes an exception report to disk.

Function: BinaryLoad(void)
Reads the binary data from disk.  This will be much faster than ASCII load, but
you must have performed a binary save first.  Also, the files will not be
portable across different endian systems.

Function: BinarySave(void)
Writes the binary data to disk.  This will be much faster but less readable to
outside sources.

Function: AsciiSave(void)
Writes out the data in EPD standard format.

Currently, we have about 650K rows, with 30K added per week.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.