1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 09:13:08 +00:00

Small comments tweaks in search.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2010-03-24 10:15:00 +01:00
parent 1fc88071d1
commit 8fabd69d4a

View file

@ -215,7 +215,7 @@ namespace {
// Step 14. Reduced search // Step 14. Reduced search
int ReductionLevel = 2; // 0 = most aggressive reductions, 7 = minimum reductions int ReductionLevel; // 0 = most aggressive reductions, 7 = minimum reductions
// Reduction lookup tables (initialized at startup) and their getter functions // Reduction lookup tables (initialized at startup) and their getter functions
int8_t PVReductionMatrix[8][64][64]; // [depth][moveNumber] int8_t PVReductionMatrix[8][64][64]; // [depth][moveNumber]
@ -1126,14 +1126,13 @@ namespace {
tte = TT.retrieve(pos.get_key()); tte = TT.retrieve(pos.get_key());
} }
// Step 10. Loop through moves
// Loop through all legal moves until no moves remain or a beta cutoff occurs
// Initialize a MovePicker object for the current position // Initialize a MovePicker object for the current position
mateThreat = pos.has_mate_threat(opposite_color(pos.side_to_move())); mateThreat = pos.has_mate_threat(opposite_color(pos.side_to_move()));
MovePicker mp = MovePicker(pos, ttMove, depth, H, &ss[ply]); MovePicker mp = MovePicker(pos, ttMove, depth, H, &ss[ply]);
CheckInfo ci(pos); CheckInfo ci(pos);
// Step 10. Loop through moves
// Loop through all legal moves until no moves remain or a beta cutoff occurs
while ( alpha < beta while ( alpha < beta
&& (move = mp.get_next_move()) != MOVE_NONE && (move = mp.get_next_move()) != MOVE_NONE
&& !TM.thread_should_stop(threadID)) && !TM.thread_should_stop(threadID))
@ -1350,12 +1349,12 @@ namespace {
} }
// Step 6. Razoring // Step 6. Razoring
if ( !value_is_mate(beta) if ( refinedValue < beta - razor_margin(depth)
&& !isCheck
&& depth < RazorDepth
&& refinedValue < beta - razor_margin(depth)
&& ss[ply - 1].currentMove != MOVE_NULL
&& ttMove == MOVE_NONE && ttMove == MOVE_NONE
&& ss[ply - 1].currentMove != MOVE_NULL
&& depth < RazorDepth
&& !isCheck
&& !value_is_mate(beta)
&& !pos.has_pawn_on_7th(pos.side_to_move())) && !pos.has_pawn_on_7th(pos.side_to_move()))
{ {
Value rbeta = beta - razor_margin(depth); Value rbeta = beta - razor_margin(depth);
@ -1445,13 +1444,12 @@ namespace {
tte = TT.retrieve(posKey); tte = TT.retrieve(posKey);
} }
// Step 10. Loop through moves
// Loop through all legal moves until no moves remain or a beta cutoff occurs
// Initialize a MovePicker object for the current position // Initialize a MovePicker object for the current position
MovePicker mp = MovePicker(pos, ttMove, depth, H, &ss[ply], beta); MovePicker mp = MovePicker(pos, ttMove, depth, H, &ss[ply], beta);
CheckInfo ci(pos); CheckInfo ci(pos);
// Step 10. Loop through moves
// Loop through all legal moves until no moves remain or a beta cutoff occurs
while ( bestValue < beta while ( bestValue < beta
&& (move = mp.get_next_move()) != MOVE_NONE && (move = mp.get_next_move()) != MOVE_NONE
&& !TM.thread_should_stop(threadID)) && !TM.thread_should_stop(threadID))
@ -1474,7 +1472,7 @@ namespace {
if ( depth >= SingularExtensionDepthAtNonPVNodes if ( depth >= SingularExtensionDepthAtNonPVNodes
&& tte && tte
&& move == tte->move() && move == tte->move()
&& !excludedMove // Do not allow recursive single-reply search && !excludedMove // Do not allow recursive singular extension search
&& ext < OnePly && ext < OnePly
&& is_lower_bound(tte->type()) && is_lower_bound(tte->type())
&& tte->depth() >= depth - 3 * OnePly) && tte->depth() >= depth - 3 * OnePly)
@ -1524,8 +1522,8 @@ namespace {
// Step 13. Make the move // Step 13. Make the move
pos.do_move(move, st, ci, moveIsCheck); pos.do_move(move, st, ci, moveIsCheck);
// Step 14. Reduced search // Step 14. Reduced search, if the move fails high
// if the move fails high will be re-searched at full depth. // will be re-searched at full depth.
bool doFullDepthSearch = true; bool doFullDepthSearch = true;
if ( depth >= 3*OnePly if ( depth >= 3*OnePly
@ -1579,11 +1577,11 @@ namespace {
} }
// Step 19. Check for mate and stalemate // Step 19. Check for mate and stalemate
// All legal moves have been searched and if there were // All legal moves have been searched and if there are
// no legal moves, it must be mate or stalemate. // no legal moves, it must be mate or stalemate.
// If one move was excluded return fail low. // If one move was excluded return fail low score.
if (!moveCount) if (!moveCount)
return excludedMove ? beta - 1 : (pos.is_check() ? value_mated_in(ply) : VALUE_DRAW); return excludedMove ? beta - 1 : (isCheck ? value_mated_in(ply) : VALUE_DRAW);
// Step 20. Update tables // Step 20. Update tables
// If the search is not aborted, update the transposition table, // If the search is not aborted, update the transposition table,
@ -1703,8 +1701,7 @@ namespace {
enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame; enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame;
futilityBase = staticValue + FutilityMarginQS + ei.futilityMargin[pos.side_to_move()]; futilityBase = staticValue + FutilityMarginQS + ei.futilityMargin[pos.side_to_move()];
// Loop through the moves until no moves remain or a beta cutoff // Loop through the moves until no moves remain or a beta cutoff occurs
// occurs.
while ( alpha < beta while ( alpha < beta
&& (move = mp.get_next_move()) != MOVE_NONE) && (move = mp.get_next_move()) != MOVE_NONE)
{ {
@ -1773,7 +1770,7 @@ namespace {
// All legal moves have been searched. A special case: If we're in check // All legal moves have been searched. A special case: If we're in check
// and no legal moves were found, it is checkmate. // and no legal moves were found, it is checkmate.
if (!moveCount && pos.is_check()) // Mate! if (!moveCount && isCheck) // Mate!
return value_mated_in(ply); return value_mated_in(ply);
// Update transposition table // Update transposition table