Revert "encapsulated positionHistory | bench 1857933"

This reverts commit 2e8c23103f.
This commit is contained in:
rektdie committed 2025-04-12 10:58:56 +02:00
1 parent ce02841a5c
commit 3275cee01e
6 files changed
+37 -34

No files matched your search

+1 -28
View File
@@ -92,31 +92,6 @@ void ListScores(Board &board, int ply, SearchContext& ctx) {
}
}
static bool IsThreefold(Board& board, SearchContext& ctx) {
for (int i = 0; i < board.positionIndex; i++) {
if (ctx.positionHistory[i] == board.hashKey) {
// repetition found
return true;
}
}
// no repetition
return false;
}
static bool IsFifty(Board& board) {
return (board.halfMoves >= 100);
}
static bool IsInsuffMat(Board& board) {
return (board.occupied.PopCount() <= 3
&& !(board.pieces[Pawn] | board.pieces[Queen] | board.pieces[Rook]));
}
static bool IsDraw(Board &board, SearchContext& ctx) {
return IsFifty(board) || IsInsuffMat(board) || IsThreefold(board, ctx);
}
static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int ply) {
int reduction = 0;
@@ -172,7 +147,6 @@ static SearchResults Quiescence(Board board, int alpha, int beta, int ply, Searc
Board copy = board;
int isLegal = copy.MakeMove(board.moveList[i]);
if (!isLegal) continue;
ctx.positionHistory[copy.positionIndex] = copy.hashKey;
ctx.nodes++;
int score = -Quiescence<mode>(copy, -beta, -alpha, ply + 1, ctx).score;
@@ -217,7 +191,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply, SearchCo
}
ctx.pvLine.SetLength(ply);
if (ply && (IsDraw(board, ctx))) return 0;
if (ply && (board.IsDraw())) return 0;
// if NOT PV node then we try to hit the TTable
@@ -287,7 +261,6 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply, SearchCo
bool isLegal = copy.MakeMove(currMove);
if (!isLegal) continue;
ctx.positionHistory[copy.positionIndex] = copy.hashKey;
ctx.nodes++;
int reductions = GetReductions(board, currMove, depth, moveSeen, ply);