S(34,68), S(83,166), S(0, 0), S( 0, 0)
};
+ const Score PawnStructureWeight = S(233, 201);
+
#undef S
+
+ inline Score apply_weight(Score v, Score w) {
+ return make_score((int(mg_value(v)) * mg_value(w)) / 0x100,
+ (int(eg_value(v)) * eg_value(w)) / 0x100);
+ }
}
assert(pos.is_ok());
Key key = pos.get_pawn_key();
- PawnInfo* pi = find(key);
+ PawnInfo* pi = probe(key);
// If pi->key matches the position's pawn hash key, it means that we
// have analysed this pawn structure before, and we can simply return
pi->pawnAttacks[WHITE] = ((wPawns << 9) & ~FileABB) | ((wPawns << 7) & ~FileHBB);
pi->pawnAttacks[BLACK] = ((bPawns >> 7) & ~FileABB) | ((bPawns >> 9) & ~FileHBB);
- // Evaluate pawns for both colors
+ // Evaluate pawns for both colors and weight the result
pi->value = evaluate_pawns<WHITE>(pos, wPawns, bPawns, pi)
- evaluate_pawns<BLACK>(pos, bPawns, wPawns, pi);
+
+ pi->value = apply_weight(pi->value, PawnStructureWeight);
+
return pi;
}