Check bonus on top of NNUE evaluation for 3check
authorFabian Fichter <ianfab@users.noreply.github.com>
Tue, 22 Dec 2020 22:58:28 +0000 (23:58 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Tue, 22 Dec 2020 22:58:28 +0000 (23:58 +0100)
In order to compensate for the lack for check counts
in the input features of the NNUE evaluation,
add an additional evaluation term on top of it.

3check STC
Score of patch vs master: 114 - 73 - 13  [0.603] 200
Elo difference: 72.2 +/- 47.8, LOS: 99.9 %, DrawRatio: 6.5 %

3check LTC
Score of patch vs master: 105 - 79 - 16  [0.565] 200
Elo difference: 45.4 +/- 46.8, LOS: 97.2 %, DrawRatio: 8.0 %

src/evaluate.cpp

index 9f22d43..8b16477 100644 (file)
@@ -1494,7 +1494,14 @@ Value Eval::evaluate(const Position& pos) {
       // Scale and shift NNUE for compatibility with search and classical evaluation
       auto  adjusted_NNUE = [&](){
          int mat = pos.non_pawn_material() + PawnValueMg * pos.count<PAWN>();
-         return NNUE::evaluate(pos) * (679 + mat / 32) / 1024 + Tempo;
+         int v2 = VALUE_ZERO;
+         if (pos.check_counting())
+         {
+             Color us = pos.side_to_move();
+             v2 =  mat / (30 * pos.checks_remaining( us))
+                 - mat / (30 * pos.checks_remaining(~us));
+         }
+         return NNUE::evaluate(pos) * (679 + mat / 32) / 1024 + Tempo + v2;
       };
 
       // If there is PSQ imbalance use classical eval, with small probability if it is small