mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 08:37:44 +00:00
Move Loop Consistency in Probcut
In probcut move loop, everything is enclosed within a large if statement. I've changed it to guard clauses to stay consistent with other move loops. closes https://github.com/official-stockfish/Stockfish/pull/5463 No functional change
This commit is contained in:
committed by
Joost VandeVondele
parent
b209f14b1e
commit
362a77a345
@@ -129,6 +129,7 @@ Kojirion
|
|||||||
Krystian Kuzniarek (kuzkry)
|
Krystian Kuzniarek (kuzkry)
|
||||||
Leonardo Ljubičić (ICCF World Champion)
|
Leonardo Ljubičić (ICCF World Champion)
|
||||||
Leonid Pechenik (lp--)
|
Leonid Pechenik (lp--)
|
||||||
|
Li Ying (yl25946)
|
||||||
Liam Keegan (lkeegan)
|
Liam Keegan (lkeegan)
|
||||||
Linmiao Xu (linrock)
|
Linmiao Xu (linrock)
|
||||||
Linus Arver (listx)
|
Linus Arver (listx)
|
||||||
|
|||||||
+45
-38
@@ -864,47 +864,54 @@ Value Search::Worker::search(
|
|||||||
Piece captured;
|
Piece captured;
|
||||||
|
|
||||||
while ((move = mp.next_move()) != Move::none())
|
while ((move = mp.next_move()) != Move::none())
|
||||||
if (move != excludedMove && pos.legal(move))
|
{
|
||||||
|
assert(move.is_ok());
|
||||||
|
|
||||||
|
if (move == excludedMove)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Check for legality
|
||||||
|
if (!pos.legal(move))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
assert(pos.capture_stage(move));
|
||||||
|
|
||||||
|
movedPiece = pos.moved_piece(move);
|
||||||
|
captured = pos.piece_on(move.to_sq());
|
||||||
|
|
||||||
|
|
||||||
|
// Prefetch the TT entry for the resulting position
|
||||||
|
prefetch(tt.first_entry(pos.key_after(move)));
|
||||||
|
|
||||||
|
ss->currentMove = move;
|
||||||
|
ss->continuationHistory =
|
||||||
|
&this->continuationHistory[ss->inCheck][true][pos.moved_piece(move)][move.to_sq()];
|
||||||
|
|
||||||
|
thisThread->nodes.fetch_add(1, std::memory_order_relaxed);
|
||||||
|
pos.do_move(move, st);
|
||||||
|
|
||||||
|
// Perform a preliminary qsearch to verify that the move holds
|
||||||
|
value = -qsearch<NonPV>(pos, ss + 1, -probCutBeta, -probCutBeta + 1);
|
||||||
|
|
||||||
|
// If the qsearch held, perform the regular search
|
||||||
|
if (value >= probCutBeta)
|
||||||
|
value =
|
||||||
|
-search<NonPV>(pos, ss + 1, -probCutBeta, -probCutBeta + 1, depth - 4, !cutNode);
|
||||||
|
|
||||||
|
pos.undo_move(move);
|
||||||
|
|
||||||
|
if (value >= probCutBeta)
|
||||||
{
|
{
|
||||||
assert(pos.capture_stage(move));
|
thisThread->captureHistory[movedPiece][move.to_sq()][type_of(captured)]
|
||||||
|
<< stat_bonus(depth - 2);
|
||||||
|
|
||||||
movedPiece = pos.moved_piece(move);
|
// Save ProbCut data into transposition table
|
||||||
captured = pos.piece_on(move.to_sq());
|
ttWriter.write(posKey, value_to_tt(value, ss->ply), ss->ttPv, BOUND_LOWER,
|
||||||
|
depth - 3, move, unadjustedStaticEval, tt.generation());
|
||||||
|
return std::abs(value) < VALUE_TB_WIN_IN_MAX_PLY ? value - (probCutBeta - beta)
|
||||||
// Prefetch the TT entry for the resulting position
|
: value;
|
||||||
prefetch(tt.first_entry(pos.key_after(move)));
|
|
||||||
|
|
||||||
ss->currentMove = move;
|
|
||||||
ss->continuationHistory =
|
|
||||||
&this
|
|
||||||
->continuationHistory[ss->inCheck][true][pos.moved_piece(move)][move.to_sq()];
|
|
||||||
|
|
||||||
thisThread->nodes.fetch_add(1, std::memory_order_relaxed);
|
|
||||||
pos.do_move(move, st);
|
|
||||||
|
|
||||||
// Perform a preliminary qsearch to verify that the move holds
|
|
||||||
value = -qsearch<NonPV>(pos, ss + 1, -probCutBeta, -probCutBeta + 1);
|
|
||||||
|
|
||||||
// If the qsearch held, perform the regular search
|
|
||||||
if (value >= probCutBeta)
|
|
||||||
value = -search<NonPV>(pos, ss + 1, -probCutBeta, -probCutBeta + 1, depth - 4,
|
|
||||||
!cutNode);
|
|
||||||
|
|
||||||
pos.undo_move(move);
|
|
||||||
|
|
||||||
if (value >= probCutBeta)
|
|
||||||
{
|
|
||||||
thisThread->captureHistory[movedPiece][move.to_sq()][type_of(captured)]
|
|
||||||
<< stat_bonus(depth - 2);
|
|
||||||
|
|
||||||
// Save ProbCut data into transposition table
|
|
||||||
ttWriter.write(posKey, value_to_tt(value, ss->ply), ss->ttPv, BOUND_LOWER,
|
|
||||||
depth - 3, move, unadjustedStaticEval, tt.generation());
|
|
||||||
return std::abs(value) < VALUE_TB_WIN_IN_MAX_PLY ? value - (probCutBeta - beta)
|
|
||||||
: value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Eval::NNUE::hint_common_parent_position(pos, networks[numaAccessToken], refreshTable);
|
Eval::NNUE::hint_common_parent_position(pos, networks[numaAccessToken], refreshTable);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user