Boost piece value of strongest piece
authorFabian Fichter <ianfab@users.noreply.github.com>
Sun, 1 Dec 2019 22:24:35 +0000 (23:24 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 1 Dec 2019 22:24:35 +0000 (23:24 +0100)
shatranj STC
LLR: 2.97 (-2.94,2.94) [0.00,10.00]
Total: 3168 W: 375 L: 300 D: 2493
http://www.variantfishtest.org:6543/tests/view/5de29de76e23db1ffe4a285e

shatranj LTC
LLR: 2.96 (-2.94,2.94) [0.00,10.00]
Total: 2416 W: 226 L: 160 D: 2030
http://www.variantfishtest.org:6543/tests/view/5de3007f6e23db1ffe4a2864

src/psqt.cpp

index cf8dfba..3242a8f 100644 (file)
@@ -125,6 +125,11 @@ Score psq[PIECE_NB][SQUARE_NB + 1];
 // tables are initialized by flipping and changing the sign of the white scores.
 void init(const Variant* v) {
 
+  PieceType strongestPiece = NO_PIECE_TYPE;
+  for (PieceType pt : v->pieceTypes)
+      if (PieceValue[MG][pt] > PieceValue[MG][strongestPiece])
+          strongestPiece = pt;
+
   for (PieceType pt = PAWN; pt <= KING; ++pt)
   {
       Piece pc = make_piece(WHITE, pt);
@@ -147,6 +152,9 @@ void init(const Variant* v) {
       if (v->capturesToHand || !v->checking)
           score = make_score(mg_value(score) * int(EndgameLimit) / (2 * EndgameLimit + mg_value(score)),
                              eg_value(score) * int(EndgameLimit) / (2 * EndgameLimit + eg_value(score)));
+      else if (pt == strongestPiece)
+              score += make_score(std::max(QueenValueMg - PieceValue[MG][pt], VALUE_ZERO) / 20,
+                                  std::max(QueenValueEg - PieceValue[EG][pt], VALUE_ZERO) / 20);
 
       // For antichess variants, use negative piece values
       if (   v->extinctionValue == VALUE_MATE