mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-23 18:46:59 +08:00
Add Tord's polynomial material balance
Use a polynomial weighted evaluation to calculate material value. This is far more flexible and elegant then applying a series of single euristic rules as before. Also correct a design issue in which we returned two values, one for middle game and one for endgame, while instead, because game phase is a function of board material itself, only one value should be calculated and used both for mid and end game. Verified it is equivalent to the tuning branch results with parameter values sampled after 40.000 games. After 999 games at 1+0 Mod vs Orig +277 =482 -240 51.85% 518.0/999 +13 ELO Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -51,8 +51,7 @@ class MaterialInfo {
|
||||
public:
|
||||
MaterialInfo() : key(0) { clear(); }
|
||||
|
||||
Value mg_value() const;
|
||||
Value eg_value() const;
|
||||
Value material_value() const;
|
||||
ScaleFactor scale_factor(const Position& pos, Color c) const;
|
||||
int space_weight() const;
|
||||
bool specialized_eval_exists() const;
|
||||
@@ -62,8 +61,7 @@ private:
|
||||
inline void clear();
|
||||
|
||||
Key key;
|
||||
int16_t mgValue;
|
||||
int16_t egValue;
|
||||
int16_t value;
|
||||
uint8_t factor[2];
|
||||
EndgameEvaluationFunctionBase* evaluationFunction;
|
||||
EndgameScalingFunctionBase* scalingFunction[2];
|
||||
@@ -102,17 +100,12 @@ private:
|
||||
//// Inline functions
|
||||
////
|
||||
|
||||
/// MaterialInfo::mg_value and MaterialInfo::eg_value simply returns the
|
||||
/// material balance evaluation for the middle game and the endgame.
|
||||
/// MaterialInfo::material_value simply returns the material balance
|
||||
/// evaluation that is independent from game phase.
|
||||
|
||||
inline Value MaterialInfo::mg_value() const {
|
||||
inline Value MaterialInfo::material_value() const {
|
||||
|
||||
return Value(mgValue);
|
||||
}
|
||||
|
||||
inline Value MaterialInfo::eg_value() const {
|
||||
|
||||
return Value(egValue);
|
||||
return Value(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +114,7 @@ inline Value MaterialInfo::eg_value() const {
|
||||
|
||||
inline void MaterialInfo::clear() {
|
||||
|
||||
mgValue = egValue = 0;
|
||||
value = 0;
|
||||
factor[WHITE] = factor[BLACK] = uint8_t(SCALE_FACTOR_NORMAL);
|
||||
evaluationFunction = NULL;
|
||||
scalingFunction[WHITE] = scalingFunction[BLACK] = NULL;
|
||||
|
||||
Reference in New Issue
Block a user