mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Merge Joona Kiiski NULL search beta correction
Prune more moves after a null search because of a lower beta limit then in main search. In test positions reduces the searched nodes of 30% !!!! Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -289,7 +289,6 @@ namespace {
|
||||
|
||||
void evaluate_space(const Position &p, Color us, EvalInfo &ei);
|
||||
inline Value apply_weight(Value v, int w);
|
||||
Value scale_by_game_phase(Value mv, Value ev, Phase ph, const ScaleFactor sf[]);
|
||||
|
||||
int count_1s_8bit(Bitboard b);
|
||||
|
||||
@@ -528,6 +527,22 @@ void read_weights(Color us) {
|
||||
}
|
||||
|
||||
|
||||
/// scale_by_game_phase() interpolates between a middle game and an endgame
|
||||
/// score, based on game phase. It also scales the return value by a
|
||||
/// ScaleFactor array.
|
||||
|
||||
Value scale_by_game_phase(Value mv, Value ev, Phase ph, const ScaleFactor sf[]) {
|
||||
|
||||
assert(mv > -VALUE_INFINITE && mv < VALUE_INFINITE);
|
||||
assert(ev > -VALUE_INFINITE && ev < VALUE_INFINITE);
|
||||
assert(ph >= PHASE_ENDGAME && ph <= PHASE_MIDGAME);
|
||||
|
||||
ev = apply_scale_factor(ev, sf[(ev > Value(0) ? WHITE : BLACK)]);
|
||||
|
||||
Value result = Value(int((mv * ph + ev * (128 - ph)) / 128));
|
||||
return Value(int(result) & ~(GrainSize - 1));
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
// evaluate_common() computes terms common to all pieces attack
|
||||
@@ -1144,23 +1159,6 @@ namespace {
|
||||
}
|
||||
|
||||
|
||||
// scale_by_game_phase() interpolates between a middle game and an endgame
|
||||
// score, based on game phase. It also scales the return value by a
|
||||
// ScaleFactor array.
|
||||
|
||||
Value scale_by_game_phase(Value mv, Value ev, Phase ph, const ScaleFactor sf[]) {
|
||||
|
||||
assert(mv > -VALUE_INFINITE && mv < VALUE_INFINITE);
|
||||
assert(ev > -VALUE_INFINITE && ev < VALUE_INFINITE);
|
||||
assert(ph >= PHASE_ENDGAME && ph <= PHASE_MIDGAME);
|
||||
|
||||
ev = apply_scale_factor(ev, sf[(ev > Value(0) ? WHITE : BLACK)]);
|
||||
|
||||
Value result = Value(int((mv * ph + ev * (128 - ph)) / 128));
|
||||
return Value(int(result) & ~(GrainSize - 1));
|
||||
}
|
||||
|
||||
|
||||
// count_1s_8bit() counts the number of nonzero bits in the 8 least
|
||||
// significant bits of a Bitboard. This function is used by the king
|
||||
// shield evaluation.
|
||||
|
||||
Reference in New Issue
Block a user