Adjust pawn value based on promotion type
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 6 Jun 2020 21:36:41 +0000 (23:36 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sat, 6 Jun 2020 21:36:41 +0000 (23:36 +0200)
shatranj STC
LLR: 2.98 (-2.94,2.94) [0.00,10.00]
Total: 3802 W: 386 L: 311 D: 3105
http://www.variantfishtest.org:6543/tests/view/5ed4336b6e23db36d55f2cf9

shatranj LTC
LLR: 2.97 (-2.94,2.94) [0.00,10.00]
Total: 2686 W: 230 L: 164 D: 2292
http://www.variantfishtest.org:6543/tests/view/5ed81b436e23db36d55f2d3b

sittuyin STC
LLR: 2.98 (-2.94,2.94) [0.00,10.00]
Total: 1820 W: 168 L: 105 D: 1547
http://www.variantfishtest.org:6543/tests/view/5ed73f8b6e23db36d55f2d19

sittuyin LTC
LLR: 2.96 (-2.94,2.94) [0.00,10.00]
Total: 2435 W: 158 L: 97 D: 2180
http://www.variantfishtest.org:6543/tests/view/5ed81bb86e23db36d55f2d3e

src/psqt.cpp

index 6b7fe5f..f904238 100644 (file)
@@ -130,6 +130,10 @@ void init(const Variant* v) {
       if (PieceValue[MG][pt] > PieceValue[MG][strongestPiece])
           strongestPiece = pt;
 
+  Value maxPromotion = VALUE_ZERO;
+  for (PieceType pt : v->promotionPieceTypes)
+      maxPromotion = std::max(maxPromotion, PieceValue[EG][pt]);
+
   for (PieceType pt = PAWN; pt <= KING; ++pt)
   {
       Piece pc = make_piece(WHITE, pt);
@@ -139,6 +143,10 @@ void init(const Variant* v) {
 
       Score score = make_score(PieceValue[MG][pc], PieceValue[EG][pc]);
 
+      // Consider promotion types in pawn score
+      if (pt == PAWN)
+          score -= make_score(0, (QueenValueEg - maxPromotion) / 100);
+
       // Scale slider piece values with board size
       const PieceInfo* pi = pieceMap.find(pt)->second;
       bool isSlider = pi->sliderQuiet.size() || pi->sliderCapture.size() || pi->hopperQuiet.size() || pi->hopperCapture.size();