X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmaterial.h;h=94c2d637e4e88a395b4a8c27152bb1ed8637fd08;hp=c99320c6686c909581e1b19ed683c28863967d38;hb=c2d42ea8339b49e52a116e488214a14fda09d413;hpb=fecefbb99cb0147f37d6895765a315f34c935786 diff --git a/src/material.h b/src/material.h index c99320c6..94c2d637 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 @@ -61,13 +68,13 @@ private: /// The MaterialInfoTable class represents a pawn hash table. The most important -/// method is get_material_info, which returns a pointer to a MaterialInfo object. +/// method is material_info(), which returns a pointer to a MaterialInfo object. class MaterialInfoTable : public SimpleHash { public: ~MaterialInfoTable(); void init(); - MaterialInfo* get_material_info(const Position& pos) const; + MaterialInfo* material_info(const Position& pos) const; static Phase game_phase(const Position& pos); private: @@ -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 {