]> git.sesse.net Git - stockfish/blobdiff - src/evaluate.cpp
Simplify material difference in evaluate
[stockfish] / src / evaluate.cpp
index c37dd98ad1c257a892930ca42385a0a2642fb5f0..728990680f6a1ac9e6fdd8df0e88a29ee327c7b3 100644 (file)
@@ -152,11 +152,8 @@ Value Eval::evaluate(const Position& pos) {
 
   Value nnue = NNUE::evaluate(pos, true, &nnueComplexity);
 
-  int material =   67 * (pos.count<PAWN>(stm)   - pos.count<PAWN>(~stm))
-                + 395 * (pos.count<KNIGHT>(stm) - pos.count<KNIGHT>(~stm))
-                + 288 * (pos.count<BISHOP>(stm) - pos.count<BISHOP>(~stm))
-                + 630 * (pos.count<ROOK>(stm)   - pos.count<ROOK>(~stm))
-                + 857 * (pos.count<QUEEN>(stm)  - pos.count<QUEEN>(~stm));
+  int material =  pos.non_pawn_material(stm) - pos.non_pawn_material(~stm)
+                + 126 * (pos.count<PAWN>(stm) - pos.count<PAWN>(~stm));
 
   // Blend optimism with nnue complexity and (semi)classical complexity
   optimism += optimism * (nnueComplexity + abs(material - nnue)) / 512;