minor corrhist | bench 1999623 #147
No files matched your search
@@ -38,6 +38,7 @@ void Board::Reset() {
|
||||
pawnKey = 0ULL;
|
||||
nonPawnKey = 0ULL;
|
||||
majorKey = 0ULL;
|
||||
minorKey = 0ULL;
|
||||
}
|
||||
|
||||
void Board::SetByFen(std::string_view fen) {
|
||||
@@ -300,6 +301,10 @@ void Board::SetPiece(int piece, int square, bool color) {
|
||||
if (piece == King || piece == Rook || piece == Queen) {
|
||||
majorKey ^= UTILS::zKeys[color][piece][square];
|
||||
}
|
||||
|
||||
if (piece == King || piece == Bishop || piece == Knight) {
|
||||
minorKey ^= UTILS::zKeys[color][piece][square];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,6 +323,10 @@ void Board::RemovePiece(int piece, int square, bool color) {
|
||||
if (piece == King || piece == Rook || piece == Queen) {
|
||||
majorKey ^= UTILS::zKeys[color][piece][square];
|
||||
}
|
||||
|
||||
if (piece == King || piece == Bishop || piece == Knight) {
|
||||
minorKey ^= UTILS::zKeys[color][piece][square];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ public:
|
||||
U64 pawnKey = 0ULL;
|
||||
U64 nonPawnKey = 0ULL;
|
||||
U64 majorKey = 0ULL;
|
||||
U64 minorKey = 0ULL;
|
||||
|
||||
void Reset();
|
||||
void SetByFen(std::string_view fen);
|
||||
|
||||
+5
-1
@@ -75,6 +75,7 @@ private:
|
||||
MultiArray<int, 2, CORRHIST_SIZE> pawnHist;
|
||||
MultiArray<int, 2, CORRHIST_SIZE> nonPawnHist;
|
||||
MultiArray<int, 2, CORRHIST_SIZE> majorHist;
|
||||
MultiArray<int, 2, CORRHIST_SIZE> minorHist;
|
||||
public:
|
||||
void Update(Board& board, int depth, int diff, int* entry) {
|
||||
const int scaledDiff = diff * CORRHIST_GRAIN;
|
||||
@@ -88,18 +89,21 @@ public:
|
||||
Update(board, depth, diff, &pawnHist[board.sideToMove][board.pawnKey % CORRHIST_SIZE]);
|
||||
Update(board, depth, diff, &nonPawnHist[board.sideToMove][board.nonPawnKey % CORRHIST_SIZE]);
|
||||
Update(board, depth, diff, &majorHist[board.sideToMove][board.majorKey % CORRHIST_SIZE]);
|
||||
Update(board, depth, diff, &minorHist[board.sideToMove][board.minorKey % CORRHIST_SIZE]);
|
||||
}
|
||||
|
||||
int GetAllHist(Board& board) {
|
||||
return pawnHist[board.sideToMove][board.pawnKey % CORRHIST_SIZE]
|
||||
+ nonPawnHist[board.sideToMove][board.nonPawnKey % CORRHIST_SIZE]
|
||||
+ majorHist[board.sideToMove][board.majorKey % CORRHIST_SIZE];
|
||||
+ majorHist[board.sideToMove][board.majorKey % CORRHIST_SIZE]
|
||||
+ minorHist[board.sideToMove][board.minorKey % CORRHIST_SIZE];
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
std::fill(&pawnHist[0][0], &pawnHist[0][0] + sizeof(pawnHist) / sizeof(int), 0);
|
||||
std::fill(&nonPawnHist[0][0], &nonPawnHist[0][0] + sizeof(nonPawnHist) / sizeof(int), 0);
|
||||
std::fill(&majorHist[0][0], &majorHist[0][0] + sizeof(majorHist) / sizeof(int), 0);
|
||||
std::fill(&minorHist[0][0], &minorHist[0][0] + sizeof(minorHist) / sizeof(int), 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user