mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-21 01:27:16 +08:00
Drop 'is' prefix from query functions
Most but not all. No functional change.
This commit is contained in:
@@ -170,7 +170,7 @@ static size_t perft(Position& pos, Depth depth) {
|
||||
|
||||
for (MoveList<LEGAL> it(pos); *it; ++it)
|
||||
{
|
||||
pos.do_move(*it, st, ci, pos.move_gives_check(*it, ci));
|
||||
pos.do_move(*it, st, ci, pos.gives_check(*it, ci));
|
||||
cnt += leaf ? MoveList<LEGAL>(pos).size() : ::perft(pos, depth - ONE_PLY);
|
||||
pos.undo_move(*it);
|
||||
}
|
||||
@@ -584,7 +584,7 @@ namespace {
|
||||
|
||||
if ( ttValue >= beta
|
||||
&& ttMove
|
||||
&& !pos.is_capture_or_promotion(ttMove)
|
||||
&& !pos.capture_or_promotion(ttMove)
|
||||
&& ttMove != ss->killers[0])
|
||||
{
|
||||
ss->killers[1] = ss->killers[0];
|
||||
@@ -738,10 +738,10 @@ namespace {
|
||||
CheckInfo ci(pos);
|
||||
|
||||
while ((move = mp.next_move<false>()) != MOVE_NONE)
|
||||
if (pos.pl_move_is_legal(move, ci.pinned))
|
||||
if (pos.legal(move, ci.pinned))
|
||||
{
|
||||
ss->currentMove = move;
|
||||
pos.do_move(move, st, ci, pos.move_gives_check(move, ci));
|
||||
pos.do_move(move, st, ci, pos.gives_check(move, ci));
|
||||
value = -search<NonPV>(pos, ss+1, -rbeta, -rbeta+1, rdepth, !cutNode);
|
||||
pos.undo_move(move);
|
||||
if (value >= rbeta)
|
||||
@@ -803,7 +803,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
if (SpNode)
|
||||
{
|
||||
// Shared counter cannot be decremented later if move turns out to be illegal
|
||||
if (!pos.pl_move_is_legal(move, ci.pinned))
|
||||
if (!pos.legal(move, ci.pinned))
|
||||
continue;
|
||||
|
||||
moveCount = ++splitPoint->moveCount;
|
||||
@@ -823,10 +823,10 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
}
|
||||
|
||||
ext = DEPTH_ZERO;
|
||||
captureOrPromotion = pos.is_capture_or_promotion(move);
|
||||
givesCheck = pos.move_gives_check(move, ci);
|
||||
captureOrPromotion = pos.capture_or_promotion(move);
|
||||
givesCheck = pos.gives_check(move, ci);
|
||||
dangerous = givesCheck
|
||||
|| pos.is_passed_pawn_push(move)
|
||||
|| pos.passed_pawn_push(move)
|
||||
|| type_of(move) == CASTLE;
|
||||
|
||||
// Step 12. Extend checks
|
||||
@@ -841,7 +841,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
if ( singularExtensionNode
|
||||
&& move == ttMove
|
||||
&& !ext
|
||||
&& pos.pl_move_is_legal(move, ci.pinned)
|
||||
&& pos.legal(move, ci.pinned)
|
||||
&& abs(ttValue) < VALUE_KNOWN_WIN)
|
||||
{
|
||||
assert(ttValue != VALUE_NONE);
|
||||
@@ -884,7 +884,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
// but fixing this made program slightly weaker.
|
||||
Depth predictedDepth = newDepth - reduction<PvNode>(improving, depth, moveCount);
|
||||
futilityValue = ss->staticEval + ss->evalMargin + futility_margin(predictedDepth, moveCount)
|
||||
+ Gains[pos.piece_moved(move)][to_sq(move)];
|
||||
+ Gains[pos.moved_piece(move)][to_sq(move)];
|
||||
|
||||
if (futilityValue < beta)
|
||||
{
|
||||
@@ -917,7 +917,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
ss->futilityMoveCount = 0;
|
||||
|
||||
// Check for legality only before to do the move
|
||||
if (!RootNode && !SpNode && !pos.pl_move_is_legal(move, ci.pinned))
|
||||
if (!RootNode && !SpNode && !pos.legal(move, ci.pinned))
|
||||
{
|
||||
moveCount--;
|
||||
continue;
|
||||
@@ -1088,7 +1088,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
|
||||
// Quiet best move: update killers, history and countermoves
|
||||
if ( bestValue >= beta
|
||||
&& !pos.is_capture_or_promotion(bestMove)
|
||||
&& !pos.capture_or_promotion(bestMove)
|
||||
&& !inCheck)
|
||||
{
|
||||
if (ss->killers[0] != bestMove)
|
||||
@@ -1100,11 +1100,11 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
// Increase history value of the cut-off move and decrease all the other
|
||||
// played non-capture moves.
|
||||
Value bonus = Value(int(depth) * int(depth));
|
||||
History.update(pos.piece_moved(bestMove), to_sq(bestMove), bonus);
|
||||
History.update(pos.moved_piece(bestMove), to_sq(bestMove), bonus);
|
||||
for (int i = 0; i < quietCount - 1; ++i)
|
||||
{
|
||||
Move m = quietsSearched[i];
|
||||
History.update(pos.piece_moved(m), to_sq(m), -bonus);
|
||||
History.update(pos.moved_piece(m), to_sq(m), -bonus);
|
||||
}
|
||||
|
||||
if (is_ok((ss-1)->currentMove))
|
||||
@@ -1220,7 +1220,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
{
|
||||
assert(is_ok(move));
|
||||
|
||||
givesCheck = pos.move_gives_check(move, ci);
|
||||
givesCheck = pos.gives_check(move, ci);
|
||||
|
||||
// Futility pruning
|
||||
if ( !PvNode
|
||||
@@ -1229,7 +1229,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
&& move != ttMove
|
||||
&& type_of(move) != PROMOTION
|
||||
&& futilityBase > -VALUE_KNOWN_WIN
|
||||
&& !pos.is_passed_pawn_push(move))
|
||||
&& !pos.passed_pawn_push(move))
|
||||
{
|
||||
futilityValue = futilityBase
|
||||
+ PieceValue[EG][pos.piece_on(to_sq(move))]
|
||||
@@ -1254,7 +1254,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
// Detect non-capture evasions that are candidate to be pruned
|
||||
evasionPrunable = InCheck
|
||||
&& bestValue > VALUE_MATED_IN_MAX_PLY
|
||||
&& !pos.is_capture(move)
|
||||
&& !pos.capture(move)
|
||||
&& !pos.can_castle(pos.side_to_move());
|
||||
|
||||
// Don't search moves with negative SEE values
|
||||
@@ -1266,7 +1266,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
continue;
|
||||
|
||||
// Check for legality only before to do the move
|
||||
if (!pos.pl_move_is_legal(move, ci.pinned))
|
||||
if (!pos.legal(move, ci.pinned))
|
||||
continue;
|
||||
|
||||
ss->currentMove = move;
|
||||
@@ -1406,7 +1406,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
|
||||
// If the threatened piece has value less than or equal to the value of the
|
||||
// threat piece, don't prune moves which defend it.
|
||||
if ( pos.is_capture(second)
|
||||
if ( pos.capture(second)
|
||||
&& ( PieceValue[MG][pos.piece_on(m2from)] >= PieceValue[MG][pos.piece_on(m2to)]
|
||||
|| type_of(pos.piece_on(m2from)) == KING))
|
||||
{
|
||||
@@ -1547,8 +1547,8 @@ void RootMove::extract_pv_from_tt(Position& pos) {
|
||||
tte = TT.probe(pos.key());
|
||||
|
||||
} while ( tte
|
||||
&& pos.is_pseudo_legal(m = tte->move()) // Local copy, TT could change
|
||||
&& pos.pl_move_is_legal(m, pos.pinned_pieces())
|
||||
&& pos.pseudo_legal(m = tte->move()) // Local copy, TT could change
|
||||
&& pos.legal(m, pos.pinned_pieces())
|
||||
&& ply < MAX_PLY
|
||||
&& (!pos.is_draw() || ply < 2));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user