p[EDGE].qval = 5; // tenjiku jump-capturer sentinel\r
}\r
\r
+int\r
+PSTest ()\r
+{\r
+ int r, f, score, tot=0;\r
+ for(r=0; r<BH; r++) for(f=0; f<BH; f++) {\r
+ int s = BW*r+f;\r
+ int piece = board[s];\r
+ if(!piece) continue;\r
+ score = p[piece].value + PST[p[piece].pst + s];\r
+ if(piece & 1) tot += score; else tot -= score;\r
+ }\r
+ return tot;\r
+}\r
+\r
int flag;\r
\r
inline int\r
nodes++;\r
pv[pvPtr++] = 0; // start empty PV, directly behind PV of parent\r
\r
- firstMove = curMove = sorted = msp += 20; // leave 20 empty slots in front of move list\r
+ firstMove = curMove = sorted = msp += 50; // leave 50 empty slots in front of move list\r
tb.fireMask = phase = 0; iterDep=1; replyDep = (depth < 1 ? depth : 1) - 1;\r
do {\r
if(flag && depth>= 0) printf("iter %d:%d\n", depth,iterDep),fflush(stdout);\r
#if 0\r
if(curEval >= beta) {\r
stm ^= WHITE;\r
- score = -Search(-beta, -iterAlpha, difEval, depth-3, promoSuppress & SQUARE, ABSENT);\r
+ score = -Search(-beta, -iterAlpha, -difEval, depth-3, promoSuppress & SQUARE, ABSENT);\r
stm ^= WHITE;\r
if(score >= beta) { msp = oldMSP; retDep += 3; return score + (score < curEval); }\r
}\r
// MOVE EXTRACTION\r
extractMove:\r
if(flag & depth >= 0) printf("%2d:%d extract %d/%d\n", depth, iterDep, curMove, msp);\r
- if(curMove < sorted) {\r
+ if(curMove > sorted) {\r
move = moveStack[sorted=j=curMove];\r
for(i=curMove+1; i<msp; i++)\r
if(moveStack[i] > move) move = moveStack[j=i]; // search move with highest priority\r
if(promoSuppress & PROMOTE) score = -INF; // non-Lion captures Lion after opponent did same\r
defer |= PROMOTE; // if we started, flag he cannot do it in reply\r
}\r
- if(score == -INF) { moveStack[curMove] = 0; goto abortMove; } // zap illegal moves\r
+ if(score == -INF) {\r
+ if(level == 1) repeatMove[repCnt++] = move & 0xFFFFFF | (p[tb.piece].value == 10*LVAL ? 3<<24 : 1 << 24);\r
+ moveStack[curMove] = 0; // zap illegal moves\r
+ goto abortMove;\r
+ }\r
}\r
#if 1\r
score = -Search(-beta, -iterAlpha, -difEval - tb.booty, replyDep, promoSuppress & ~PROMOTE, defer);\r
int i; // WB thinking output\r
printf("%d %d %d %d", iterDep, bestScore, (GetTickCount() - startTime)/10, nodes);\r
for(i=0; pv[i]; i++) printf(" %s", MoveToText(pv[i], 0));\r
- printf("\n"); fflush(stdout);\r
+ if(iterDep == 1) printf(" { root eval = %4.2f dif = %4.2f; abs = %4.2f}", curEval/100., difEval/100., PSTest()/100.);\r
+ printf("\n");\r
+ fflush(stdout);\r
}\r
if(GetTickCount() - startTime > tlim1) break; // do not start iteration we can (most likely) not finish\r
}\r
for(i=retFirst; i<retMSP; i++) printf("# %d. %08x %08x %s\n", i-50, moveStack[i], ret, MoveToText(moveStack[i], 0));\r
reason = NULL;\r
for(i=0; i<repCnt; i++) {if((repeatMove[i] & 0xFFFFFF) == ret) {\r
- reason = "Repeats earlier position";\r
+ if(repeatMove[i] & 1<<24) reason = (repeatMove[i] & 1<<25 ? "Distant capture of protected Lion" : "Counterstrike against Lion");\r
+ else reason = "Repeats earlier position";\r
break;\r
}\r
printf("# %d. %08x %08x %s\n", i, repeatMove[i], ret, MoveToText(repeatMove[i], 0));\r