ChessPartner book format

This article is mainly based on the ChessPartner book optimizer documentation. See our downloads page.

The ChessPartner opening books are stored in files with a .BK extension.

The format of the .BK files is based on storing positions, together with each position the possible moves in that position are stored. Depending on the format with each move the score, or statistics information is stored.

The file is further divided in records of a fixed length. Next step, the records are organized in chains. All the positions in a chains share a part of the positions hash signature. The records of a chain may be spread across the file.

The first record of each chain is stored in the hash index table. This is a table of a fixed size which is always resident in memory. The size of this table determines the number chains there are. To look up a position, first a part of the hash signature is taken to look up the first record of the chain in the hash index table. Then the chain is read record by record to search for the correct position.

Now a few things affect the performance, most important factor is the average length of each chain, the more records in a chain the longer it takes to either find the position or to know the position does not exist. How can we affect the length of each chain, that's easy, the bigger the hash index table is, the more chains there are and thus the shorter each chain is. There is a downside, having more chains means there are most likely more records which are not fully filled, thus wasting disk space.

The default books have a record size of 1024, it is generally not necessary to change this. The hash index size has a default of 256, depending on the size of the book a value of 2048 may be a better value. The book optimizer utility can be used to alter these values.

Maximum number of positions a book can hold; this depends on the record size and the format of the book ( with or without statistics ). A .BK file can hold a maximum of 65534 records, with a record size of 1024 the maximum book files size is 64 MB, with an average use of 10 bytes per position the default book can hold a maximum of approx 6.7 million unique positions. In practice the maximum is less because the book can not be filled for 100%