mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08:00
@@ -174,7 +174,7 @@ namespace {
|
|||||||
S(-20,-12), S( 1, -8), S( 2, 10), S( 9, 10)
|
S(-20,-12), S( 1, -8), S( 2, 10), S( 9, 10)
|
||||||
};
|
};
|
||||||
|
|
||||||
// KingProtector[PieceType-2] * "distance to own king" determines a bonus for each piece.
|
// KingProtector[PieceType-2] contains a bonus according to distance from king
|
||||||
const Score KingProtector[] = { S(-3, -5), S(-4, -3), S(-3, 0), S(-1, 1) };
|
const Score KingProtector[] = { S(-3, -5), S(-4, -3), S(-3, 0), S(-1, 1) };
|
||||||
|
|
||||||
// Assorted bonuses and penalties used by evaluation
|
// Assorted bonuses and penalties used by evaluation
|
||||||
@@ -293,6 +293,7 @@ namespace {
|
|||||||
|
|
||||||
mobility[Us] += MobilityBonus[Pt - 2][mob];
|
mobility[Us] += MobilityBonus[Pt - 2][mob];
|
||||||
|
|
||||||
|
// Bonus for this piece as a king protector
|
||||||
score += KingProtector[Pt - 2] * distance(s, pos.square<KING>(Us));
|
score += KingProtector[Pt - 2] * distance(s, pos.square<KING>(Us));
|
||||||
|
|
||||||
if (Pt == BISHOP || Pt == KNIGHT)
|
if (Pt == BISHOP || Pt == KNIGHT)
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ Move MovePicker::next_move(bool skipQuiets) {
|
|||||||
move = pick_best(cur++, endMoves);
|
move = pick_best(cur++, endMoves);
|
||||||
if (move != ttMove)
|
if (move != ttMove)
|
||||||
{
|
{
|
||||||
if (pos.see_ge(move, VALUE_ZERO))
|
if (pos.see_ge(move))
|
||||||
return move;
|
return move;
|
||||||
|
|
||||||
// Losing capture, move it to the beginning of the array
|
// Losing capture, move it to the beginning of the array
|
||||||
|
|||||||
@@ -164,11 +164,13 @@ namespace {
|
|||||||
e->passedPawns[Us] |= s;
|
e->passedPawns[Us] |= s;
|
||||||
|
|
||||||
else if ( stoppers == SquareBB[s + Up]
|
else if ( stoppers == SquareBB[s + Up]
|
||||||
&& relative_rank(Us, s) >= RANK_5
|
&& relative_rank(Us, s) >= RANK_5)
|
||||||
&& (b = (shift<Up>(supported) & ~theirPawns)))
|
{
|
||||||
|
b = shift<Up>(supported) & ~theirPawns;
|
||||||
while (b)
|
while (b)
|
||||||
if (!more_than_one(theirPawns & PawnAttacks[Us][pop_lsb(&b)]))
|
if (!more_than_one(theirPawns & PawnAttacks[Us][pop_lsb(&b)]))
|
||||||
e->passedPawns[Us] |= s;
|
e->passedPawns[Us] |= s;
|
||||||
|
}
|
||||||
|
|
||||||
// Score this pawn
|
// Score this pawn
|
||||||
if (!neighbours)
|
if (!neighbours)
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public:
|
|||||||
void undo_null_move();
|
void undo_null_move();
|
||||||
|
|
||||||
// Static Exchange Evaluation
|
// Static Exchange Evaluation
|
||||||
bool see_ge(Move m, Value value) const;
|
bool see_ge(Move m, Value value = VALUE_ZERO) const;
|
||||||
|
|
||||||
// Accessing hash keys
|
// Accessing hash keys
|
||||||
Key key() const;
|
Key key() const;
|
||||||
|
|||||||
@@ -895,7 +895,7 @@ moves_loop: // When in check search starts from here
|
|||||||
}
|
}
|
||||||
else if ( givesCheck
|
else if ( givesCheck
|
||||||
&& !moveCountPruning
|
&& !moveCountPruning
|
||||||
&& pos.see_ge(move, VALUE_ZERO))
|
&& pos.see_ge(move))
|
||||||
extension = ONE_PLY;
|
extension = ONE_PLY;
|
||||||
|
|
||||||
// Calculate new depth for this move
|
// Calculate new depth for this move
|
||||||
@@ -980,7 +980,7 @@ moves_loop: // When in check search starts from here
|
|||||||
// castling moves, because they are coded as "king captures rook" and
|
// castling moves, because they are coded as "king captures rook" and
|
||||||
// hence break make_move().
|
// hence break make_move().
|
||||||
else if ( type_of(move) == NORMAL
|
else if ( type_of(move) == NORMAL
|
||||||
&& !pos.see_ge(make_move(to_sq(move), from_sq(move)), VALUE_ZERO))
|
&& !pos.see_ge(make_move(to_sq(move), from_sq(move))))
|
||||||
r -= 2 * ONE_PLY;
|
r -= 2 * ONE_PLY;
|
||||||
|
|
||||||
ss->history = cmh[moved_piece][to_sq(move)]
|
ss->history = cmh[moved_piece][to_sq(move)]
|
||||||
@@ -1116,7 +1116,6 @@ moves_loop: // When in check search starts from here
|
|||||||
: inCheck ? mated_in(ss->ply) : DrawValue[pos.side_to_move()];
|
: inCheck ? mated_in(ss->ply) : DrawValue[pos.side_to_move()];
|
||||||
else if (bestMove)
|
else if (bestMove)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Quiet best move: update move sorting heuristics
|
// Quiet best move: update move sorting heuristics
|
||||||
if (!pos.capture_or_promotion(bestMove))
|
if (!pos.capture_or_promotion(bestMove))
|
||||||
update_stats(pos, ss, bestMove, quietsSearched, quietCount, stat_bonus(depth));
|
update_stats(pos, ss, bestMove, quietsSearched, quietCount, stat_bonus(depth));
|
||||||
@@ -1290,7 +1289,7 @@ moves_loop: // When in check search starts from here
|
|||||||
// Don't search moves with negative SEE values
|
// Don't search moves with negative SEE values
|
||||||
if ( (!InCheck || evasionPrunable)
|
if ( (!InCheck || evasionPrunable)
|
||||||
&& type_of(move) != PROMOTION
|
&& type_of(move) != PROMOTION
|
||||||
&& !pos.see_ge(move, VALUE_ZERO))
|
&& !pos.see_ge(move))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Speculative prefetch as early as possible
|
// Speculative prefetch as early as possible
|
||||||
|
|||||||
Reference in New Issue
Block a user