syzygy wrote: ↑Sun Dec 02, 2018 7:18 pm
The only bytes in a TB file that use the "Stockfish encoding" are the bytes that are read in that line. So if you convert it there, then that should be it. Unless some other part of the TB probing code silently depends on the SF encoding. (Line 70 is an obvious example: the PieceToChar string.)
this is my code to convert from:
Code: Select all
enum Piece {
NO_PIECE,
W_PAWN = 1, W_KNIGHT, W_BISHOP, W_ROOK, W_QUEEN, W_KING,
B_PAWN = 9, B_KNIGHT, B_BISHOP, B_ROOK, B_QUEEN, B_KING,
PIECE_NB = 16
};
to:
Code: Select all
occupiedSquares=0, //0 00000000
whiteKing=1, //1 00000001
whiteQueens=2, //2 00000010
whiteRooks=3, //3 00000011
whiteBishops=4, //4 00000100
whiteKnights=5, //5 00000101
whitePawns=6, //6 00000110
whitePieces=7, //7 00000111
separationBitmap=8,
blackKing=9, //9 00001001
blackQueens=10, //10 00001010
blackRooks=11, //11 00001011
blackBishops=12, //12 00001100
blackKnights=13, //13 00001101
blackPawns=14, //14 00001110
blackPieces=15, //15 00001111
Code: Select all
for (int k = 0; k < e.pieceCount; ++k, ++data)
for (int i = 0; i < sides; i++)
{
uint8_t convertedData = i ? *data >> 4 : *data & 0xF;
bool color = isBlackPiece((bitboardIndex)convertedData);
uint8_t piece = getPieceType((bitboardIndex)convertedData);
piece = 7 - piece;
convertedData = color | piece;
e.get(i, f)->pieces[k] = (bitboardIndex)convertedData;
}
from what I have understood e.get(i, f)->pieces[k] will store the 4 bit ( with color information ) info about the piece. so I have to mantain the color, but invert the order of pieces.
I'll try it asap