Rewrite piece value scaling
authorFabian Fichter <ianfab@users.noreply.github.com>
Sun, 29 Mar 2020 14:47:35 +0000 (16:47 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 29 Mar 2020 14:47:35 +0000 (16:47 +0200)
grand STC
LLR: 2.96 (-2.94,2.94) [0.00,10.00]
Total: 5784 W: 2326 L: 2163 D: 1295
http://www.variantfishtest.org:6543/tests/view/5e7ce6266e23db4f73614a83

grand LTC
LLR: 2.98 (-2.94,2.94) [-10.00,5.00]
Total: 1251 W: 479 L: 433 D: 339
http://www.variantfishtest.org:6543/tests/view/5e7dbc626e23db4f73614aa6

courier STC
LLR: 2.97 (-2.94,2.94) [-10.00,5.00]
Total: 973 W: 271 L: 230 D: 472
http://www.variantfishtest.org:6543/tests/view/5e7c60b76e23db4f73614a80

courier LTC
LLR: 3.00 (-2.94,2.94) [-10.00,5.00]
Total: 836 W: 215 L: 174 D: 447
http://www.variantfishtest.org:6543/tests/view/5e7ce75b6e23db4f73614a95

capablanca STC
LLR: 2.97 (-2.94,2.94) [-10.00,5.00]
Total: 1299 W: 523 L: 476 D: 300
http://www.variantfishtest.org:6543/tests/view/5e7c60826e23db4f73614a7d

capablanca LTC (failed)
LLR: -2.99 (-2.94,2.94) [-10.00,5.00]
Total: 2137 W: 728 L: 796 D: 613
http://www.variantfishtest.org:6543/tests/view/5e7ce7646e23db4f73614a97

losalamos STC
LLR: 2.95 (-2.94,2.94) [-10.00,5.00]
Total: 2446 W: 594 L: 562 D: 1290
http://www.variantfishtest.org:6543/tests/view/5e7ce6596e23db4f73614a85

losalamos LTC
LLR: 2.95 (-2.94,2.94) [-10.00,5.00]
Total: 4187 W: 964 L: 941 D: 2282
http://www.variantfishtest.org:6543/tests/view/5e7db9626e23db4f73614aa4

src/psqt.cpp

index 33c830d..0b2d37c 100644 (file)
@@ -143,9 +143,14 @@ void init(const Variant* v) {
       const PieceInfo* pi = pieceMap.find(pt)->second;
       if (pi->sliderQuiet.size() || pi->sliderCapture.size())
       {
-          int offset = pi->stepsQuiet.size() || pi->stepsCapture.size() ? 16 : 6;
-          score = make_score(mg_value(score) * (v->maxRank + v->maxFile + offset) / (14 + offset),
-                             eg_value(score) * (v->maxRank + v->maxFile + offset) / (14 + offset));
+          constexpr int lc = 5;
+          constexpr int rm = 5;
+          constexpr int r0 = rm + RANK_8;
+          int r1 = rm + (v->maxRank + v->maxFile) / 2;
+          int leaper = pi->stepsQuiet.size() + pi->stepsCapture.size();
+          int slider = pi->sliderQuiet.size() + pi->sliderCapture.size();
+          score = make_score(mg_value(score) * (lc * leaper + r1 * slider) / (lc * leaper + r0 * slider),
+                             eg_value(score) * (lc * leaper + r1 * slider) / (lc * leaper + r0 * slider));
       }
 
       // For drop variants, halve the piece values