X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmaterial.h;h=e33fc87bdf8c2ae8f590b64aba27b133c7ac7271;hp=18c0f944892b96830a58af30373f0ba59952e6a2;hb=14df99130f53a2a5f57260eb830b4c0029bd4e99;hpb=b5d5646c840d63710552fdaf2521a054dd3b8a18 diff --git a/src/material.h b/src/material.h index 18c0f944..e33fc87b 100644 --- a/src/material.h +++ b/src/material.h @@ -27,6 +27,13 @@ const int MaterialTableSize = 8192; +/// Game phase +enum Phase { + PHASE_ENDGAME = 0, + PHASE_MIDGAME = 128 +}; + + /// MaterialInfo is a class which contains various information about a /// material configuration. It contains a material balance evaluation, /// a function pointer to a special endgame evaluation function (which in @@ -65,8 +72,8 @@ private: class MaterialInfoTable : public SimpleHash { public: - MaterialInfoTable(); ~MaterialInfoTable(); + void init(); MaterialInfo* get_material_info(const Position& pos) const; static Phase game_phase(const Position& pos); @@ -90,12 +97,12 @@ inline ScaleFactor MaterialInfo::scale_factor(const Position& pos, Color c) cons if (!scalingFunction[c]) return ScaleFactor(factor[c]); - ScaleFactor sf = scalingFunction[c]->apply(pos); + ScaleFactor sf = (*scalingFunction[c])(pos); return sf == SCALE_FACTOR_NONE ? ScaleFactor(factor[c]) : sf; } inline Value MaterialInfo::evaluate(const Position& pos) const { - return evaluationFunction->apply(pos); + return (*evaluationFunction)(pos); } inline Score MaterialInfo::material_value() const {