tried to implement viri move format
This commit is contained in:
1 parent
4889715e47
commit
5ad924f3c6
3 files changed
+44
-2
No files matched your search
+1
-1
@@ -259,7 +259,7 @@ void Run(int targetPositions, int threads) {
|
|||||||
if (!results.bestMove) break;
|
if (!results.bestMove) break;
|
||||||
safeResults = results;
|
safeResults = results;
|
||||||
|
|
||||||
game.moves.push_back(ScoredMove(results.bestMove, results.score));
|
game.moves.push_back(ScoredMove(results.bestMove.ConvertToViriMoveFormat(), results.score));
|
||||||
board.MakeMove(results.bestMove);
|
board.MakeMove(results.bestMove);
|
||||||
MOVEGEN::GenerateMoves<All>(board);
|
MOVEGEN::GenerateMoves<All>(board);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ struct ScoredMove {
|
|||||||
|
|
||||||
ScoredMove() : move(0), score(0) {}
|
ScoredMove() : move(0), score(0) {}
|
||||||
|
|
||||||
ScoredMove(Move m, int s) {
|
ScoredMove(uint16_t m, int16_t s) {
|
||||||
move = m;
|
move = m;
|
||||||
score = s;
|
score = s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,48 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t ConvertToViriMoveFormat() {
|
||||||
|
uint16_t viriMove = 0;
|
||||||
|
int flags = GetFlags();
|
||||||
|
|
||||||
|
// Set from and to squares (6 bits each)
|
||||||
|
viriMove |= MoveFrom();
|
||||||
|
viriMove |= MoveTo() << 6;
|
||||||
|
|
||||||
|
// Determine move type (bits 12-13)
|
||||||
|
uint16_t moveType = 0;
|
||||||
|
uint16_t promoPiece = 0;
|
||||||
|
|
||||||
|
if (flags == kingCastle || flags == queenCastle) {
|
||||||
|
moveType = 1; // Castling
|
||||||
|
}
|
||||||
|
else if (flags == epCapture) {
|
||||||
|
moveType = 2; // En passant
|
||||||
|
}
|
||||||
|
else if (flags >= knightPromotion && flags <= queenPromoCapture) {
|
||||||
|
moveType = 3; // Promotion
|
||||||
|
// Set promo piece (bits 14-15)
|
||||||
|
if (flags == knightPromotion || flags == knightPromoCapture) {
|
||||||
|
promoPiece = 0; // Knight
|
||||||
|
}
|
||||||
|
else if (flags == bishopPromotion || flags == bishopPromoCapture) {
|
||||||
|
promoPiece = 1; // Bishop
|
||||||
|
}
|
||||||
|
else if (flags == rookPromotion || flags == rookPromoCapture) {
|
||||||
|
promoPiece = 2; // Rook
|
||||||
|
}
|
||||||
|
else if (flags == queenPromotion || flags == queenPromoCapture) {
|
||||||
|
promoPiece = 3; // Queen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// else moveType remains 0 (normal move)
|
||||||
|
|
||||||
|
viriMove |= moveType << 12;
|
||||||
|
viriMove |= promoPiece << 14;
|
||||||
|
|
||||||
|
return viriMove;
|
||||||
|
}
|
||||||
|
|
||||||
operator uint16_t() {
|
operator uint16_t() {
|
||||||
return m_move;
|
return m_move;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user