But they might not use the same storage format. So comparison could be non-trivial. And you would have to ignore differences for broken and illegal positions. (Note that my code is not from any engine, but just a stand-alone code that does nothing but fill the array bitbase[], and then exit. So one could add a loop to print out this array in main().)
But it should be possible to test data and probing code together, by writing a small program that loops over all possible positions, and compares the probe results for the two formats.
Btw, Ippolit also contains a KPK bitbase, as an array of initialized data (and is public domain).
I now realize that the probing routine I gave above only works when white has the Pawn. A more general routine would take an extra parameter to indicate which side has the Pawn, so that it could be used for KPK as wll as KKP:
Code: Select all
int
KPK_is_won (int stm, int wK, int bK, int wP, int pawnOwner)
{
int index = bK ^ 64*wK ^ 32*64*wP;
index ^= -(wP & 1) & 034707; // flip horizontally if Pawn on odd file
index ^= -pawnOwner & 0347070;
return bitbase[2*(index>>3) + stm - 64*64] & 1<<(index & 7);
}
with the peculiarity that 'stm' would have to specify the 'relative' side to move, i.e. 0 = pawnOwner and 1 = bare King. (For pawnOwner it would be 0 = white, 1 = black, assuming that white plays 'up the board, i.e. square numbers 0-7 are the first rank, etc.')