GenCapts(int sqr, int victimValue)\r
{ // generate all moves that capture the piece on the given square\r
int i, range, att = attacks[2*sqr + stm];\r
-//printf("GenCapts(%d,%d)\n",sqr,victimValue);\r
+//printf("GenCapts(%c%d,%d) %08x\n",sqr%BW+'a',sqr/BW,victimValue,att);\r
if(!att) return; // no attackers at all!\r
for(i=0; i<8; i++) { // try all rays\r
int x, v, jumper, jcapt=0;\r
for(i=0; i<8; i++) { // scan all knight jumps to locate source\r
int x = sqr - nStep[i], attacker = board[x];\r
if(attacker == EMPTY || (attacker & TYPE) != stm) continue;\r
- if(p[attacker].range[i] <= N && p[attacker].range[i] >= S) { // has Knight jump in our direction\r
+ if(p[attacker].range[i] <= N && p[attacker].range[i] >= S && p[attacker].range[i] != J) { // has Knight jump in our direction\r
NewCapture(x, sqr + victimValue, p[attacker].promoFlag); // plain jump (as in N)\r
if(p[attacker].range[i] < N) { // Lion power; generate double captures over two possible intermediates\r
int v = kStep[i]; // leftish path\r
tlim2 = 1.9*targetTime;\r
nodes = 0;\r
MapFromScratch(attacks);\r
+ retMove = INVALID;\r
score = Search(-INF-1, INF+1, rootEval, 20, sup1, sup2);\r
*move = retMove;\r
*ponderMove = INVALID;\r
score = SearchBestMove(stm, timeLeft, mps, timeControl, inc, timePerMove, &move, &ponderMove);\r
\r
if(move == INVALID) { // game apparently ended\r
+ int kcapt = 0, xstm = stm ^ WHITE, king, k = p[king=royal[xstm]].pos;\r
+ if( k != ABSENT) { // test if King capture possible\r
+ if(attacks[2*k + stm]) {\r
+ if( p[king + 2].pos == ABSENT ) kcapt = 1; // we have an attack on his only King\r
+ }\r
+ } else { // he has no king! Test for attacks on Crown Prince\r
+ k = p[king + 2].pos;\r
+ if(attacks[2*k + stm]) kcapt = 1; // we have attack on Crown Prince\r
+ }\r
+ if(kcapt) { // print King capture before claiming\r
+ GenCapts(k, 0);\r
+ printf("move %s\n", MoveToText(moveStack[msp-1], 1));\r
+ }\r
engineSide = NONE; // so stop playing\r
PrintResult(stm, score);\r
} else {\r