#include "evaluate.h"
#include "material.h"
#include "pawns.h"
-#include "scale.h"
#include "thread.h"
#include "ucioption.h"
Square s = pop_1st_bit(&b);
Square queeningSquare = relative_square(c, make_square(square_file(s), RANK_8));
int d = square_distance(s, queeningSquare)
- - (relative_rank(c, s) == RANK_2) // Double pawn push
+ - int(relative_rank(c, s) == RANK_2) // Double pawn push
- square_distance(pos.king_square(opposite_color(c)), queeningSquare)
+ int(c != pos.side_to_move());
}
- // 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.
+ // 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(const Score& v, Phase ph, const ScaleFactor sf[]) {
assert(eg_value(v) > -VALUE_INFINITE && eg_value(v) < VALUE_INFINITE);
assert(ph >= PHASE_ENDGAME && ph <= PHASE_MIDGAME);
- Value ev = apply_scale_factor(eg_value(v), sf[(eg_value(v) > Value(0) ? WHITE : BLACK)]);
+ Value eg = eg_value(v);
+ ScaleFactor f = sf[eg > Value(0) ? WHITE : BLACK];
+ Value ev = Value((eg * f) / SCALE_FACTOR_NORMAL);
int result = (mg_value(v) * ph + ev * (128 - ph)) / 128;
return Value(result & ~(GrainSize - 1));