X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmaterial.cpp;h=114f083171fe748423c83070cb619d853ad44096;hp=dc2a3a3b550c6eddaf9e8e1d378e5921c77bf72b;hb=c8e5384c3a4a5d9ac709c9b50954907a7f07109c;hpb=802fca6fdd562c4c52397521eb0ac05cb2be9046 diff --git a/src/material.cpp b/src/material.cpp index dc2a3a3b..114f0831 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -58,6 +58,12 @@ namespace { 24, -32, 107, -51, 117, -9, -126, -21, 31 }; + // QueenMinorsImbalance[opp_minor_count] is applied when only one side has a queen. + // It contains a bonus/malus for the side with the queen. + const int QueenMinorsImbalance[16] = { + 31, -8, -15, -25, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + // Endgame evaluation and scaling functions are accessed directly and not through // the function maps because they correspond to more than one material hash key. Endgame EvaluateKXK[] = { Endgame(WHITE), Endgame(BLACK) }; @@ -111,6 +117,10 @@ namespace { bonus += pieceCount[Us][pt1] * v; } + // Special handling of Queen vs. Minors + if (pieceCount[Us][QUEEN] == 1 && pieceCount[Them][QUEEN] == 0) + bonus += QueenMinorsImbalance[pieceCount[Them][KNIGHT] + pieceCount[Them][BISHOP]]; + return bonus; }