} UndoInfo;\r
\r
int bWidth, bHeight, bsize, zone, currentVariant;\r
-int stm, xstm, hashKeyH, hashKeyL, framePtr, msp, nonCapts, rootEval, retMSP, retFirst, pvPtr, level, cnt50, chuFlag=1;\r
+int stm, xstm, hashKeyH, hashKeyL, framePtr, msp, nonCapts, rootEval, retMSP, retFirst, pvPtr, level, cnt50, chuFlag=1, mobilityScore;\r
int nodes, startTime, tlim1, tlim2;\r
Move retMove, moveStack[10000], path[100], repStack[300], pv[1000];\r
\r
int\r
AddPiece (int stm, PieceDesc *list)\r
{\r
- int i, j, *key;\r
+ int i, j, *key, v;\r
for(i=stm+2; i<=last[stm]; i += 2) {\r
if(p[i].value < 10*list->value || p[i].value == 10*list->value && (p[i].promo < 0)) break;\r
}\r
last[stm] += 2;\r
for(j=last[stm]; j>i; j-= 2) p[j] = p[j-2];\r
- p[i].value = 10*list->value;\r
+ p[i].value = v = 10*list->value;\r
for(j=0; j<8; j++) p[i].range[j] = list->range[j^4*(WHITE-stm)];\r
switch(Range(p[i].range)) {\r
case 1: p[i].pst = BH; break;\r
if(!*key) *key = ~(myRandom()*myRandom());\r
p[i].pieceKey = *key;\r
p[i].promoFlag = 0;\r
+ p[i].mobWeight = v > 600 ? 0 : v >= 400 ? 1 : v >= 300 ? 2 : v > 150 ? 3 : v >= 100 ? 2 : 0;\r
for(j=stm+2; j<= last[stm]; j+=2) {\r
if(p[j].promo >= i) p[j].promo += 2;\r
}\r
{\r
}\r
\r
-void\r
+int\r
MapOneColor (int start, int last, int *map)\r
{\r
- int i, j, k;\r
+ int i, j, k, totMob = 0;\r
for(i=start+2; i<=last; i+=2) {\r
+ int mob = 0;\r
if(p[i].pos == ABSENT) continue;\r
for(j=0; j<8; j++) {\r
int x = p[i].pos, v = kStep[j], r = p[i].range[j];\r
} else\r
if(r >= S) { // in any case, do a jump of 2\r
if(board[x + 2*v] != EMPTY && board[x + 2*v] != EDGE)\r
- map[2*(x + 2*v) + start] += one[j];\r
+ map[2*(x + 2*v) + start] += one[j], mob += (board[x + 2*v] ^ start) & 1;\r
if(r < J) { // Lion power, also single step\r
if(board[x + v] != EMPTY && board[x + v] != EDGE)\r
map[2*(x + v) + start] += one[j];\r
}\r
while(r-- > 0) {\r
if(board[x+=v] != EMPTY) {\r
- if(board[x] != EDGE) map[2*x + start] += one[j];\r
+ mob += dist[x-v-p[i].pos];\r
+ if(board[x] != EDGE) map[2*x + start] += one[j], mob += (board[x] ^ start) & 1;\r
break;\r
}\r
}\r
}\r
+ totMob += mob * p[i].mobWeight;\r
}\r
+if(!level) printf("# mobility %d = %d\n", start, totMob);\r
+ return totMob;\r
}\r
\r
void\r
{\r
int i;\r
for(i=0; i<2*bsize; i++) map[i] = 0;\r
- MapOneColor(0, last[BLACK], map);\r
- MapOneColor(1, last[WHITE], map);\r
+ mobilityScore = MapOneColor(1, last[WHITE], map);\r
+ mobilityScore -= MapOneColor(0, last[BLACK], map);\r
}\r
\r
void\r
int\r
Evaluate ()\r
{\r
- return 0;\r
+ return (stm ? mobilityScore : -mobilityScore);\r
}\r
\r
int\r