#define XWINGS\r
#define KINGSAFETY\r
#define KSHIELD\r
-#define XFORTRESS\r
+#define FORTRESS\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
if(i == kylin[WHITE]) p[i].promoGain = 1.25*KYLIN, p[i].value += KYLIN;\r
// if(j > 0 && p[i].pst == PST_STEPPER) p[i].pst = PST_WPPROM; // use white pre-prom bonus\r
if(j > 0 && p[i].pst == PST_STEPPER && p[i].value >= 100)\r
- p[i].pst = p[i].value <= 150 ? PST_ADVANCE : PST_NEUTRAL; // light steppers advance\r
+ p[i].pst = p[i].value <= 150 ? PST_ADVANCE : PST_WPPROM; // 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)*0.9, p[i].value = p[j].value - g;\r
int g = p[i].promoGain;\r
// if(j > 0 && p[i].pst == PST_STEPPER) p[i].pst = PST_BPPROM; // use black pre-prom bonus\r
if(j > 0 && p[i].pst == PST_STEPPER && p[i].value >= 100)\r
- p[i].pst = p[i].value <= 150 ? PST_RETRACT : PST_NEUTRAL; // light steppers advance\r
+ p[i].pst = p[i].value <= 150 ? PST_RETRACT : PST_BPPROM; // light steppers advance\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
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
+ if(j > (BH-1)/2 - 3 && j < BH/2 + 3)\r
+ PST[PST_WPPROM + j] += 4, PST[PST_BPPROM + BW*(BH-1) + j] += 4; // fortress\r
+ if(j > (BH-1)/2 - 2 && j < BH/2 + 2)\r
+ PST[PST_WPPROM + BW + j] += 2, PST[PST_BPPROM + BW*(BH-2) + j] += 2; // fortress\r
#if KYLIN\r
// pre-promotion bonuses for jumpers\r
if(zone > 0) PST[PST_WJUMPER + BW*(BH-2-zone) + j] = PST[PST_BJUMPER + BW*(zone+1) + j] = 100,\r
int\r
Fortress (int forward, int king, int lion)\r
{ // penalty for lack of Lion-proof fortress\r
- int rank = PST[king], anchor, r, l, q;\r
- if(!rank) return -300;\r
+ int rank = PST[king], anchor, r, l, q, res = 0;\r
+ if(rank != 2) return 25*(rank-2);\r
anchor = king + forward*(rank-1);\r
\r
+ q = Guard(anchor); l = Guard(anchor-1); r = Guard(anchor+1);\r
+ if(!q) return l > 1 || r > 1 ? 0 : -25;\r
+ if(q == 1) res = 40*(l > 1 && r > 1); // TGT, EGT or TGE get 40\r
+ else { // T or E in front of King\r
+ if(l > 1) res = 30 + (r > 1)*(20 + 5*(q==2)); // TT., ET. or TE. (30), TET (50), TTE (55)\r
+ else if(r > 1) res = 30; // .TT, .ET or .TE (30)\r
+ }\r
+ q = 0;\r
+ if(filling > 32) {\r
+ if(r > 1 && Guard(king+2) == 1) q += 10;\r
+ if(l > 1 && Guard(king-2) == 1) q += 10; \r
+ q += 5*(Guard(king+1) == 1);\r
+ q += 5*(Guard(king-1) == 1);\r
+ if(filling < 96) q = q*(filling - 32)>>6;\r
+ }\r
+ return res + q;\r
+\r
if(Guard(anchor) == 3 || Guard(anchor+1) == 3 || Guard(anchor-1) == 3) return 0;\r
if(rank == 2 && Guard(king+1) == 3 || Guard(king-1) == 3) return -50;\r
if(Guard(r=anchor) == 2 || Guard(r=anchor+1) == 2 || Guard(r=anchor-1) == 2)\r
f = 0;\r
if(bLion != ABSENT) f += Fortress( BW, wKing, bLion);\r
if(wLion != ABSENT) f -= Fortress(-BW, bKing, wLion);\r
- score += (filling < 96 ? f : f*(224 - filling) >> 7); // build up slowly\r
+ score += (filling < 192 ? f : f*(224 - filling) >> 5); // build up slowly\r
# endif\r
\r
# ifdef KSHIELD\r