@@ -28,43 +28,26 @@ namespace {
2828
2929 // / Constants
3030
31- const int MoveHorizon = 50 ; // Plan time management at most this many moves ahead
31+ const int MoveHorizon = 50 ; // Plan time management at most this many moves ahead
3232 const double MaxRatio = 7.0 ; // When in trouble, we can step over reserved time with this ratio
3333 const double StealRatio = 0.33 ; // However we must not steal time from remaining moves over this ratio
3434
35+ const double xscale = 9.3 ;
36+ const double xshift = 59.8 ;
37+ const double yscale = 7780 ;
38+ const double yshift = 1e-3 ; // Larger than 0. Ensures a non-zero importance
39+ const double skewfactor = 0.172 ;
3540
36- // MoveImportance[] is based on naive statistical analysis of "how many games are still undecided
37- // after n half-moves". Game is considered "undecided" as long as neither side has >275cp advantage.
38- // Data was extracted from CCRL game database with some simple filtering criteria.
39- const int MoveImportance[512 ] = {
40- 7780 , 7780 , 7780 , 7780 , 7780 , 7780 , 7780 , 7780 , 7780 , 7780 , 7780 , 7780 , 7780 , 7780 , 7780 , 7780 ,
41- 7780 , 7780 , 7780 , 7780 , 7778 , 7778 , 7776 , 7776 , 7776 , 7773 , 7770 , 7768 , 7766 , 7763 , 7757 , 7751 ,
42- 7743 , 7735 , 7724 , 7713 , 7696 , 7689 , 7670 , 7656 , 7627 , 7605 , 7571 , 7549 , 7522 , 7493 , 7462 , 7425 ,
43- 7385 , 7350 , 7308 , 7272 , 7230 , 7180 , 7139 , 7094 , 7055 , 7010 , 6959 , 6902 , 6841 , 6778 , 6705 , 6651 ,
44- 6569 , 6508 , 6435 , 6378 , 6323 , 6253 , 6152 , 6085 , 5995 , 5931 , 5859 , 5794 , 5717 , 5646 , 5544 , 5462 ,
45- 5364 , 5282 , 5172 , 5078 , 4988 , 4901 , 4831 , 4764 , 4688 , 4609 , 4536 , 4443 , 4365 , 4293 , 4225 , 4155 ,
46- 4085 , 4005 , 3927 , 3844 , 3765 , 3693 , 3634 , 3560 , 3479 , 3404 , 3331 , 3268 , 3207 , 3146 , 3077 , 3011 ,
47- 2947 , 2894 , 2828 , 2776 , 2727 , 2676 , 2626 , 2589 , 2538 , 2490 , 2442 , 2394 , 2345 , 2302 , 2243 , 2192 ,
48- 2156 , 2115 , 2078 , 2043 , 2004 , 1967 , 1922 , 1893 , 1845 , 1809 , 1772 , 1736 , 1702 , 1674 , 1640 , 1605 ,
49- 1566 , 1536 , 1509 , 1479 , 1452 , 1423 , 1388 , 1362 , 1332 , 1304 , 1289 , 1266 , 1250 , 1228 , 1206 , 1180 ,
50- 1160 , 1134 , 1118 , 1100 , 1080 , 1068 , 1051 , 1034 , 1012 , 1001 , 980 , 960 , 945 , 934 , 916 , 900 , 888 ,
51- 878 , 865 , 852 , 828 , 807 , 787 , 770 , 753 , 744 , 731 , 722 , 706 , 700 , 683 , 676 , 671 , 664 , 652 , 641 ,
52- 634 , 627 , 613 , 604 , 591 , 582 , 568 , 560 , 552 , 540 , 534 , 529 , 519 , 509 , 495 , 484 , 474 , 467 , 460 ,
53- 450 , 438 , 427 , 419 , 410 , 406 , 399 , 394 , 387 , 382 , 377 , 372 , 366 , 359 , 353 , 348 , 343 , 337 , 333 ,
54- 328 , 321 , 315 , 309 , 303 , 298 , 293 , 287 , 284 , 281 , 277 , 273 , 265 , 261 , 255 , 251 , 247 , 241 , 240 ,
55- 235 , 229 , 218 , 217 , 213 , 212 , 208 , 206 , 197 , 193 , 191 , 189 , 185 , 184 , 180 , 177 , 172 , 170 , 170 ,
56- 170 , 166 , 163 , 159 , 158 , 156 , 155 , 151 , 146 , 141 , 138 , 136 , 132 , 130 , 128 , 125 , 123 , 122 , 118 ,
57- 118 , 118 , 117 , 115 , 114 , 108 , 107 , 105 , 105 , 105 , 102 , 97 , 97 , 95 , 94 , 93 , 91 , 88 , 86 , 83 , 80 ,
58- 80 , 79 , 79 , 79 , 78 , 76 , 75 , 72 , 72 , 71 , 70 , 68 , 65 , 63 , 61 , 61 , 59 , 59 , 59 , 58 , 56 , 55 , 54 , 54 ,
59- 52 , 49 , 48 , 48 , 48 , 48 , 45 , 45 , 45 , 44 , 43 , 41 , 41 , 41 , 41 , 40 , 40 , 38 , 37 , 36 , 34 , 34 , 34 , 33 ,
60- 31 , 29 , 29 , 29 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 27 , 27 , 27 , 27 , 27 , 24 , 24 , 23 , 23 , 22 , 21 , 20 , 20 ,
61- 19 , 19 , 19 , 19 , 19 , 18 , 18 , 18 , 18 , 17 , 17 , 17 , 17 , 17 , 16 , 16 , 15 , 15 , 14 , 14 , 14 , 12 , 12 , 11 ,
62- 9 , 9 , 9 , 9 , 9 , 9 , 9 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 ,
63- 8 , 8 , 8 , 8 , 7 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 5 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 ,
64- 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 3 , 3 , 2 , 2 , 2 , 2 ,
65- 2 , 1 , 1 , 1 , 1 , 1 , 1 , 1 };
66-
67- int move_importance (int ply) { return MoveImportance[std::min (ply, 511 )]; }
41+
42+ // / move_importance() is a skew-logistic function based on naive statistical
43+ // / analysis of "how many games are still undecided after n half-moves". Game
44+ // / is considered "undecided" as long as neither side has >275cp advantage.
45+ // / Data was extracted from CCRL game database with some simple filtering criteria.
46+
47+ double move_importance (int ply) {
48+
49+ return yscale / pow ((1 + exp ((ply - xshift) / xscale)), skewfactor) + yshift;
50+ }
6851
6952
7053 // / Function Prototypes
@@ -147,8 +130,8 @@ namespace {
147130 const double TMaxRatio = (T == OptimumTime ? 1 : MaxRatio);
148131 const double TStealRatio = (T == OptimumTime ? 0 : StealRatio);
149132
150- double thisMoveImportance = double (move_importance (currentPly) * slowMover) / 100 ;
151- int otherMovesImportance = 0 ;
133+ double thisMoveImportance = (move_importance (currentPly) * slowMover) / 100 ;
134+ double otherMovesImportance = 0 ;
152135
153136 for (int i = 1 ; i < movesToGo; ++i)
154137 otherMovesImportance += move_importance (currentPly + 2 * i);
0 commit comments