X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmaterial.h;h=114e24d5ff330d6906e0c4330d15addaa5c384e2;hp=1a5f110547ca6dcf8d1a2abc35a2228cc892e62c;hb=9a542d96981e6cb45b6b01f17258a078cf27da36;hpb=c88eebc98905b47077ef2b35b35ea5705d448d4f diff --git a/src/material.h b/src/material.h index 1a5f1105..114e24d5 100644 --- a/src/material.h +++ b/src/material.h @@ -25,7 +25,14 @@ #include "tt.h" #include "types.h" -const int MaterialTableSize = 1024; +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, @@ -53,8 +60,8 @@ private: Key key; int16_t value; uint8_t factor[2]; - EndgameEvaluationFunctionBase* evaluationFunction; - EndgameScalingFunctionBase* scalingFunction[2]; + EndgameBase* evaluationFunction; + EndgameBase* scalingFunction[2]; int spaceWeight; Phase gamePhase; }; @@ -62,12 +69,11 @@ 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. -class EndgameFunctions; class MaterialInfoTable : public SimpleHash { public: - MaterialInfoTable(); ~MaterialInfoTable(); + void init(); MaterialInfo* get_material_info(const Position& pos) const; static Phase game_phase(const Position& pos); @@ -75,7 +81,7 @@ private: template static int imbalance(const int pieceCount[][8]); - EndgameFunctions* funcs; + Endgames* funcs; }; @@ -95,6 +101,10 @@ inline ScaleFactor MaterialInfo::scale_factor(const Position& pos, Color c) cons return sf == SCALE_FACTOR_NONE ? ScaleFactor(factor[c]) : sf; } +inline Value MaterialInfo::evaluate(const Position& pos) const { + return evaluationFunction->apply(pos); +} + inline Score MaterialInfo::material_value() const { return make_score(value, value); } @@ -111,8 +121,4 @@ inline bool MaterialInfo::specialized_eval_exists() const { return evaluationFunction != NULL; } -inline Value MaterialInfo::evaluate(const Position& pos) const { - return evaluationFunction->apply(pos); -} - #endif // !defined(MATERIAL_H_INCLUDED)