Now that we have a good clear specification of the Polyglot opening book format, I think endgame bitbases should be next.
When testing Sloppy with valgrind I noticed that the Scorpio egbb library leaks a lot of memory. I took a look at the source code, and couldn't understand it well enough due to unorthodox programming practices and lack of documentation. So I became interested in rewriting the whole thing in clean C++, but to do that I'd need to know the file format. Can anyone help me out here?
Scorpio endgame bitbase specs?
Moderators: hgm, Rebel, chrisw
-
- Posts: 750
- Joined: Mon Mar 27, 2006 7:45 pm
- Location: Finland
-
- Posts: 670
- Joined: Mon Dec 03, 2007 3:01 pm
- Location: Barcelona, Spain
Re: Scorpio endgame bitbase specs?
Just had a quick look at the sourcecode .. if you have any more specific questions I will have to look more precisely.
Scorpio bitbases accept 2 types of files .. compressed and uncompressed
For compression the huffman compression is used.
Then, the important question is how each position is indexed.
Therefor the pieces are ordered per piecetype (note: black pieces > white pieces) Board is mirrored and flipped (using symmetry). For the Kings it uses a preindexed table. Furthermore it uses the fact that there is a maximum of 1 piece per square.
eg. a 3 piece endgame KxK (where x != pawn)
p1 = wk
p2 = bk
p3 = x
in case of KKx .. sides are reversed first and afterwards result inverted
For the case of KPK:
if the pawn is on the left side of the board: flip the board
... you can find all this information in static void get_index(...)
how to use this index you find in
int EGBB::get_score(UBMP32 index,PSEARCHER psearcher)
for the uncompressed version:
Scorpio bitbases accept 2 types of files .. compressed and uncompressed
For compression the huffman compression is used.
Then, the important question is how each position is indexed.
Therefor the pieces are ordered per piecetype (note: black pieces > white pieces) Board is mirrored and flipped (using symmetry). For the Kings it uses a preindexed table. Furthermore it uses the fact that there is a maximum of 1 piece per square.
eg. a 3 piece endgame KxK (where x != pawn)
p1 = wk
p2 = bk
p3 = x
in case of KKx .. sides are reversed first and afterwards result inverted
Code: Select all
kki = KK_index[p1 * 64 + p2];
p3i = p3 - (p3 > p1) - (p3 > p2);
pos_index = kki * 62 + p3i;
if the pawn is on the left side of the board: flip the board
Code: Select all
if(file64(p3) > FILED) {
p1 = MIRRORF64(p1);
p2 = MIRRORF64(p2);
p3 = MIRRORF64(p3);
}
kki = KK_WP_index[p1 * 64 + p2];
p3i = SQ6424(p3);
pos_index = kki * 24 + p3i;
how to use this index you find in
int EGBB::get_score(UBMP32 index,PSEARCHER psearcher)
for the uncompressed version:
Code: Select all
score = VALUE[(table[index >> 2] >> (2 * (index & 3))) & 3];
-
- Posts: 750
- Joined: Mon Mar 27, 2006 7:45 pm
- Location: Finland
Re: Scorpio endgame bitbase specs?
Thanks a lot. I'll see how far I can get with this.