X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmaterial.cpp;h=b180f797b56032c74d122c5cd236755b27be9909;hp=11fd3c9b235cfe5ba8baaa542694186f69a6aa9a;hb=76381cbd6903f8be571cbc0d644a0f78026134bc;hpb=f178f0a2912082e2e9d07d9b0926031322d78f67 diff --git a/src/material.cpp b/src/material.cpp index 11fd3c9b..b180f797 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -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; @@ -237,6 +238,18 @@ MaterialInfo* MaterialInfoTable::get_material_info(const Position& pos) { } } + // Compute the space weight + if (pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK) >= + 2*QueenValueMidgame + 4*RookValueMidgame + 2*KnightValueMidgame) + { + int minorPieceCount = pos.piece_count(WHITE, KNIGHT) + + pos.piece_count(BLACK, KNIGHT) + + pos.piece_count(WHITE, BISHOP) + + pos.piece_count(BLACK, BISHOP); + + mi->spaceWeight = minorPieceCount * minorPieceCount; + } + // Evaluate the material balance int sign; @@ -297,7 +310,7 @@ MaterialInfo* MaterialInfoTable::get_material_info(const Position& pos) { /// EndgameFunctions member definitions. This class is used to store the maps -/// of end game and scaling functions that MaterialInfoTable will query for +/// of end game and scaling functions that MaterialInfoTable will query for /// each key. The maps are constant and are populated only at construction, /// but are per-thread instead of globals to avoid expensive locks.