// promotions by pieces with Lion power stepping in & out the zone in same turn\r
// promotion on capture\r
\r
-#define VERSION "0.18"\r
+#define VERSION "0.19"\r
\r
//define PATH level==0 || path[0] == 0x1103a && (level==1 || path[1] == 0x6f0f6 && (level == 2 /*|| path[2] == 0x8710f && (level == 3 /*|| path[3] == 0x3e865 && (level == 4 || path[4] == 0x4b865 && (level == 5)))*/))\r
#define PATH 0\r
#define KSHIELD\r
#define XFORTRESS\r
#define PAWNBLOCK\r
+#define TANDEM 100 /* bonus for pairs of attacking light steppers */\r
#define KYLIN 100 /* extra end-game value of Kylin for promotability */\r
#define PROMO 0 /* extra bonus for 'vertical' piece when it actually promotes (diagonal pieces get half) */\r
\r
int i, m=0;\r
for(i=0; i<8; i++) {\r
int d = r[i];\r
- if(r[i] < 0) d == r[i] >= L ? 2 : 36;\r
+ if(r[i] < 0) d = r[i] >= L ? 2 : 36;\r
if(d > m) m = d;\r
}\r
return m;\r
p[i].pst = p[i].value <= 150 ? PST_ADVANCE : PST_NEUTRAL; // light steppers advance\r
if(j > 0 && p[i].bulk == 6) p[i].pst = PST_WFLYER, p[i].mobWeight = 4; // SM defends zone\r
if((j = p[i].promo) > 0 && g)\r
- p[i].promoGain = (p[j].value - p[i].value - g)*1.25, p[i].value = p[j].value - g;\r
+ p[i].promoGain = (p[j].value - p[i].value - g)*0.9, p[i].value = p[j].value - g;\r
else p[i].promoGain = 0;\r
board[p[i].pos] = i;\r
rootEval += p[i].value + PST[p[i].pst + p[i].pos];\r
if(j > 0 && p[i].pst == PST_WJUMPER) p[i].pst = PST_BJUMPER; // use black pre-prom bonus\r
if(j > 0 && p[i].bulk == 6) p[i].pst = PST_BFLYER, p[i].mobWeight = 4; // SM defends zone\r
if((j = p[i].promo) > 0 && g)\r
- p[i].promoGain = (p[j].value - p[i].value - g)*1.25, p[i].value = p[j].value - g;\r
+ p[i].promoGain = (p[j].value - p[i].value - g)*0.9, p[i].value = p[j].value - g;\r
else p[i].promoGain = 0;\r
if(i == kylin[BLACK]) p[i].promoGain = 1.25*KYLIN, p[i].value += KYLIN;\r
board[p[i].pos] = i;\r
PST[PST_STEPPER+s] = d/4 - (i < 2 || i > BH-3 ? 3 : 0) - (j == 0 || j == BH-1 ? 5 : 0)\r
+ 3*(i==zone || i==BH-zone-1); // stepper centralization\r
PST[PST_WJUMPER+s] = d/6; // double-stepper centralization\r
- PST[PST_SLIDER +s] = d/12 - 5*(i==BH/2 || i==(BH-1)/2); // slider centralization\r
+ PST[PST_SLIDER +s] = d/12 - 15*(i==BH/2 || i==(BH-1)/2);// slider centralization\r
PST[PST_TRAP +s] = j < 3 || j > BH-4 ? (i < 3 ? 7 : i == 3 ? 4 : i == 4 ? 2 : 0) : 0;\r
PST[PST_CENTER+s] = ((BH-1)*(BH-1) - (2*i - BH + 1)*(2*i - BH + 1) - (2*j - BH + 1)*(2*j - BH + 1))/6;\r
PST[PST_WPPROM+s] = PST[PST_BPPROM+s] = PST[PST_STEPPER+s]; // as stepper, but with pre-promotion bonus W/B\r
PST[PST_BJUMPER+s] = PST[PST_WJUMPER+s]; // as jumper, but with pre-promotion bonus B\r
PST[PST_ZONDIST+s] = BW*(zone - 1 - i); // board step to enter promo zone black\r
- PST[PST_ADVANCE+s] = PST[PST_WFLYER-s-1] = 2*(5*i+i*i) - (i >= zone)*8*(i-zone+1)*(i-zone+1)\r
- - 50 - 10*(j==0 || j == BH-1); // advance-encouraging table\r
+ PST[PST_ADVANCE+s] = PST[PST_WFLYER-s-1] = 2*(5*i+i*i) - (i >= zone)*6*(i-zone+1)*(i-zone+1)\r
+ - (2*j - BH + 1)*(2*j - BH + 1)/BH + BH/2\r
+ - 50 - 35*(j==0 || j == BH-1) - 15*(j == 1 || BH-2); // advance-encouraging table\r
PST[PST_WFLYER +s] = PST[PST_END-s-1] = (i == zone-1)*40 + (i == zone-2)*20 - 20;\r
}\r
if(zone > 0) PST[PST_WPPROM+BW*(BH-1-zone) + j] += 10, PST[PST_BPPROM + BW*zone + j] += 10;\r
#endif\r
\r
#ifdef PAWNBLOCK\r
- // penalty for blocking own P or GB: 20 by slider, 10 by other, but 50 if only retreat mode is straight back\r
+ // penalty for blocking own P or GB: 20 by slider, 10 by other, but 50 if only RETRACT mode is straight back\r
for(i=last[WHITE]; i > 1 && p[i].value<=50; i-=2) {\r
if((f = p[i].pos) != ABSENT) { // P present,\r
if((j = board[f + BW])&1) // square before it white (odd) piece\r
}\r
#endif\r
\r
- return difEval - (filling*filling*promoDelta >> 16) + (stm ? score : -score);\r
+#ifdef TANDEM\r
+ if(zone > 0) {\r
+ int rw = BW*(BH-1-zone), rb = BW*zone, h=0;\r
+ for(f=0; f<BH; f++) {\r
+ if(p[board[rw+f]].pst == PST_ADVANCE) {\r
+ h += (p[board[rw+f-BW]].pst == PST_ADVANCE);\r
+ if(f > 0) h += (p[board[rw+f-BW-1]].pst == PST_ADVANCE);\r
+ if(f+1 < BH) h += (p[board[rw+f-BW+1]].pst == PST_ADVANCE);\r
+ }\r
+ if(p[board[rb+f]].pst == PST_ADVANCE) {\r
+ h -= (p[board[rb+f+BW]].pst == PST_RETRACT);\r
+ if(f > 0) h -= (p[board[rb+f+BW-1]].pst == PST_RETRACT);\r
+ if(f+1 < BH) h -= (p[board[rb+f+BW+1]].pst == PST_RETRACT);\r
+ }\r
+ }\r
+ score += h*TANDEM;\r
+ }\r
+#endif\r
+\r
+ return difEval - (filling*promoDelta >> 8) + (stm ? score : -score);\r
}\r
\r
inline void\r
score = -Search(-beta, -iterAlpha, -difEval - tb.booty, iterDep-1+ext,\r
curMove >= late && iterDep > QSdepth + LMR,\r
promoSuppress & ~PROMOTE, defer, depth ? INF : tb.gain);\r
+\r
#else\r
score = 0;\r
#endif\r