X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmaterial.cpp;h=845bc90df6e0207deb5cf12c3007ed7a51064bd0;hb=67375f4693c97fb1321864bb4d143812cd824f9b;hp=6a51cb64da97bd1284bf161d4de8d87b96803bb8;hpb=c97104e8540b72ee2c6c9c13d3773d2c0f9ec32f;p=stockfish diff --git a/src/material.cpp b/src/material.cpp index 6a51cb64..845bc90d 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -54,20 +54,20 @@ class EndgameFunctions { public: EndgameFunctions(); - EndgameEvaluationFunction* getEEF(Key key) const; - ScalingFunction* getESF(Key key, Color* c) const; + EndgameEvaluationFunctionBase* getEEF(Key key) const; + EndgameScalingFunctionBase* getESF(Key key, Color* c) const; private: - void add(Key k, EndgameEvaluationFunction* f); - void add(Key k, Color c, ScalingFunction* f); + void add(Key k, EndgameEvaluationFunctionBase* f); + void add(Key k, Color c, EndgameScalingFunctionBase* f); struct ScalingInfo { Color col; - ScalingFunction* fun; + EndgameScalingFunctionBase* fun; }; - std::map EEFmap; + std::map EEFmap; std::map ESFmap; }; @@ -143,7 +143,8 @@ MaterialInfo* MaterialInfoTable::get_material_info(const Position& pos) { } // Let's look if we have a specialized evaluation function for this - // particular material configuration. + // particular material configuration. First we look for a fixed + // configuration one, then a generic one if previous search failed. if ((mi->evaluationFunction = funcs->getEEF(key)) != NULL) return mi; @@ -186,7 +187,7 @@ MaterialInfo* MaterialInfoTable::get_material_info(const Position& pos) { // are several conflicting applicable scaling functions and we need to // decide which one to use. Color c; - ScalingFunction* sf; + EndgameScalingFunctionBase* sf; if ((sf = funcs->getESF(key, &c)) != NULL) { @@ -354,24 +355,24 @@ EndgameFunctions::EndgameFunctions() { add(z[W][ROOK][1] ^ z[W][PAWN][1] ^ z[B][ROOK][1] ^ z[B][PAWN][1] ^ z[B][PAWN][2], B, &ScaleKRPKRPP); } -void EndgameFunctions::add(Key k, EndgameEvaluationFunction* f) { +void EndgameFunctions::add(Key k, EndgameEvaluationFunctionBase* f) { - EEFmap.insert(std::pair(k, f)); + EEFmap.insert(std::pair(k, f)); } -void EndgameFunctions::add(Key k, Color c, ScalingFunction* f) { +void EndgameFunctions::add(Key k, Color c, EndgameScalingFunctionBase* f) { ScalingInfo s = {c, f}; ESFmap.insert(std::pair(k, s)); } -EndgameEvaluationFunction* EndgameFunctions::getEEF(Key key) const { +EndgameEvaluationFunctionBase* EndgameFunctions::getEEF(Key key) const { - std::map::const_iterator it(EEFmap.find(key)); + std::map::const_iterator it(EEFmap.find(key)); return (it != EEFmap.end() ? it->second : NULL); } -ScalingFunction* EndgameFunctions::getESF(Key key, Color* c) const { +EndgameScalingFunctionBase* EndgameFunctions::getESF(Key key, Color* c) const { std::map::const_iterator it(ESFmap.find(key)); if (it == ESFmap.end())