minor corrhist | bench 1406680
This commit is contained in:
1 parent
ecd57607f3
commit
3b2cb8839b
3 files changed
+13
-2
No files matched your search
@@ -45,6 +45,7 @@ void Board::Reset() {
|
|||||||
pawnKey = 0ULL;
|
pawnKey = 0ULL;
|
||||||
nonPawnKey = 0ULL;
|
nonPawnKey = 0ULL;
|
||||||
majorKey = 0ULL;
|
majorKey = 0ULL;
|
||||||
|
minorKey = 0ULL;
|
||||||
|
|
||||||
checkZones = std::array<Bitboard, 4>();
|
checkZones = std::array<Bitboard, 4>();
|
||||||
}
|
}
|
||||||
@@ -97,6 +98,7 @@ void Board::SetByFen(std::string_view fen) {
|
|||||||
pawnKey = 0ULL;
|
pawnKey = 0ULL;
|
||||||
nonPawnKey = 0ULL;
|
nonPawnKey = 0ULL;
|
||||||
majorKey = 0ULL;
|
majorKey = 0ULL;
|
||||||
|
minorKey = 0ULL;
|
||||||
|
|
||||||
occupied = colors[White] | colors[Black];
|
occupied = colors[White] | colors[Black];
|
||||||
hashKey = UTILS::GetHashKey(*this);
|
hashKey = UTILS::GetHashKey(*this);
|
||||||
@@ -310,6 +312,8 @@ void Board::SetPiece(int piece, int square, bool color) {
|
|||||||
|
|
||||||
if (piece == King || piece == Rook || piece == Queen) {
|
if (piece == King || piece == Rook || piece == Queen) {
|
||||||
majorKey ^= UTILS::zKeys[color][piece][square];
|
majorKey ^= UTILS::zKeys[color][piece][square];
|
||||||
|
} else if (piece == Knight || piece == Bishop) {
|
||||||
|
minorKey ^= UTILS::zKeys[color][piece][square];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -330,6 +334,8 @@ void Board::RemovePiece(int piece, int square, bool color) {
|
|||||||
|
|
||||||
if (piece == King || piece == Rook || piece == Queen) {
|
if (piece == King || piece == Rook || piece == Queen) {
|
||||||
majorKey ^= UTILS::zKeys[color][piece][square];
|
majorKey ^= UTILS::zKeys[color][piece][square];
|
||||||
|
} else if (piece == Knight || piece == Bishop) {
|
||||||
|
minorKey ^= UTILS::zKeys[color][piece][square];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -48,6 +48,7 @@ public:
|
|||||||
U64 pawnKey = 0ULL;
|
U64 pawnKey = 0ULL;
|
||||||
U64 nonPawnKey = 0ULL;
|
U64 nonPawnKey = 0ULL;
|
||||||
U64 majorKey = 0ULL;
|
U64 majorKey = 0ULL;
|
||||||
|
U64 minorKey = 0ULL;
|
||||||
|
|
||||||
std::array<Bitboard, 4> checkZones;
|
std::array<Bitboard, 4> checkZones;
|
||||||
|
|
||||||
@@ -90,4 +91,4 @@ public:
|
|||||||
|
|
||||||
bool IsLegal(Move &move);
|
bool IsLegal(Move &move);
|
||||||
bool IsPseudoLegal(Move &move);
|
bool IsPseudoLegal(Move &move);
|
||||||
};
|
};
|
||||||
+5
-1
@@ -82,6 +82,7 @@ private:
|
|||||||
MultiArray<int, 2, CORRHIST_SIZE> pawnHist;
|
MultiArray<int, 2, CORRHIST_SIZE> pawnHist;
|
||||||
MultiArray<int, 2, CORRHIST_SIZE> nonPawnHist;
|
MultiArray<int, 2, CORRHIST_SIZE> nonPawnHist;
|
||||||
MultiArray<int, 2, CORRHIST_SIZE> majorHist;
|
MultiArray<int, 2, CORRHIST_SIZE> majorHist;
|
||||||
|
MultiArray<int, 2, CORRHIST_SIZE> minorHist;
|
||||||
public:
|
public:
|
||||||
void Update(Board& board, int depth, int diff, int* entry) {
|
void Update(Board& board, int depth, int diff, int* entry) {
|
||||||
const int scaledDiff = diff * CORRHIST_GRAIN;
|
const int scaledDiff = diff * CORRHIST_GRAIN;
|
||||||
@@ -95,18 +96,21 @@ public:
|
|||||||
Update(board, depth, diff, &pawnHist[board.sideToMove][board.pawnKey % CORRHIST_SIZE]);
|
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, &nonPawnHist[board.sideToMove][board.nonPawnKey % CORRHIST_SIZE]);
|
||||||
Update(board, depth, diff, &majorHist[board.sideToMove][board.majorKey % 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) {
|
int GetAllHist(Board& board) {
|
||||||
return pawnHist[board.sideToMove][board.pawnKey % CORRHIST_SIZE]
|
return pawnHist[board.sideToMove][board.pawnKey % CORRHIST_SIZE]
|
||||||
+ nonPawnHist[board.sideToMove][board.nonPawnKey % 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() {
|
void Clear() {
|
||||||
std::fill(&pawnHist[0][0], &pawnHist[0][0] + sizeof(pawnHist) / sizeof(int), 0);
|
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(&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(&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