-////
-//// Functions
-////
-
-/// MaterialInfoTable c'tor and d'tor, called once by each thread
-
-MaterialInfoTable::MaterialInfoTable() {
-
- entries = new MaterialInfo[MaterialTableSize];
- funcs = new EndgameFunctions();
-
- if (!entries || !funcs)
- {
- cerr << "Failed to allocate " << MaterialTableSize * sizeof(MaterialInfo)
- << " bytes for material hash table." << endl;
- exit(EXIT_FAILURE);
- }
- memset(entries, 0, MaterialTableSize * sizeof(MaterialInfo));
-}
-
-MaterialInfoTable::~MaterialInfoTable() {
-
- delete funcs;
- delete [] entries;
-}
-
-
-/// MaterialInfoTable::game_phase() calculates the phase given the current
-/// position. Because the phase is strictly a function of the material, it
-/// is stored in MaterialInfo.
-
-Phase MaterialInfoTable::game_phase(const Position& pos) {
-
- Value npm = pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK);