int from, to, piece, victim, new, booty, epSquare, epVictim, ep2Square, ep2Victim, savKeyL, savKeyH;\r
} UndoInfo;\r
\r
-int stm, xstm, hashKeyH, hashKeyL, framePtr, msp, nonCapts, rootEval, retMSP, retFirst, level, chuFlag=1;\r
+int stm, xstm, hashKeyH, hashKeyL, framePtr, msp, nonCapts, rootEval, retMSP, retFirst, pvPtr, level, chuFlag=1;\r
int nodes, startTime, tlim1, tlim2;\r
-Move retMove, moveStack[10000], path[100];\r
+Move retMove, moveStack[10000], path[100], pv[1000];\r
\r
#define X 36 /* slider */\r
#define J -1 /* jump */\r
Search (int alpha, int beta, int difEval, int depth, int oldPromo, int promoSuppress)\r
{\r
int i, j, k, firstMove, oldMSP = msp, curMove, sorted, bad, phase, king, iterDep, replyDep, nextVictim, to, defer, dubious, bestMoveNr;\r
+ int myPV = pvPtr;\r
int score, bestScore, curEval, iterAlpha;\r
Move move, nullMove;\r
UndoInfo tb;\r
alpha -= (alpha < curEval);\r
beta -= (beta <= curEval);\r
\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
phase = 0; iterDep=1; replyDep = (depth < 1 ? depth : 1) - 1;\r
do {\r
// update killer\r
goto cutoff;\r
}\r
+ { int i=pvPtr;\r
+ for(pvPtr = myPV+1; pv[pvPtr++] = pv[i++]; ); // copy daughter PV\r
+ pv[myPV] = move; // behind our move (pvPtr left at end of copy)\r
+ }\r
}\r
\r
}\r
} while(++iterDep <= depth); // next depth\r
retMSP = msp;\r
retFirst = firstMove;\r
- msp = oldMSP;\r
+ msp = oldMSP; // pop move list\r
+ pvPtr = myPV; // pop PV\r
retMove = bestMoveNr ? moveStack[bestMoveNr] : 0;\r
if(flag && depth >= 0) printf("return %d: %d %d\n", depth, bestScore, curEval);\r
return bestScore + (bestScore < curEval);\r