#define attacks (rawAttacks + 23)
static int attackKey, rawAttacks[13*22];
int depthLimit = MAXPLY;
+char moveMap[1<<16]; // excluded root moves
int
MoveGen (int stm, MoveStack *m, int castle)
}
}
+ if(ply == 0 && moveMap[moveStack[curMove] & 0xFFFF]) continue; // excluded root move
+
// make move
if(MakeMove(&f, moveStack[curMove])) { // aborts if fails to evade existing check
else printf("0-1\n");
}
+void
+MapClear (int n)
+{
+ int i; for(i=0; i<0x10000; i++) moveMap[i] = n;
+}
+
int ponderMove;
char inBuf[800];
return 1;
}
if(!strcmp(command, "protover")){
- printf("feature ping=1 setboard=1 colors=0 usermove=1 memory=1 debug=1 reuse=0 sigint=0 sigterm=0 myname=\"CrazyWa " VERSION "\"\n");
+ printf("feature ping=1 setboard=1 colors=0 usermove=1 memory=1 debug=1 reuse=0 sigint=0 sigterm=0 exclude=1 myname=\"CrazyWa " VERSION "\"\n");
printf("feature variants=\"crazyhouse,shogi,minishogi,judkinshogi,torishogi,euroshogi,crazywa,kyotoshogi,"
"5x5+4_shogi,5x5+5_shogi,6x6+6_shogi,7x7+6_shogi,11x17+16_chu\"\n");
printf("feature option=\"Resign -check 0\"\n"); // example of an engine-defined option
if(!strcmp(command, "memory")) { if(SetMemorySize(atoi(inBuf+7))) printf("tellusererror Not enough memory\n"), exit(-1); return 1; }
if(!strcmp(command, "ping")) { printf("pong%s", inBuf+4); return 1; }
// if(!strcmp(command, "")) { sscanf(inBuf, " %d", &); return 1; }
- if(!strcmp(command, "new")) { engineSide = BLACK; stm = WHITE; maxDepth = MAXPLY-2; randomize = OFF; moveNr = 0; ranKey = GetTickCount() | 0x1001; return 1; }
+ if(!strcmp(command, "new")) { engineSide = BLACK; stm = WHITE; maxDepth = MAXPLY-2; randomize = OFF;
+ moveNr = 0; ranKey = GetTickCount() | 0x1001; MapClear(0); return 1; }
if(!strcmp(command, "variant")) { GameInit(inBuf + 8); Setup(startPos); return 1; }
- if(!strcmp(command, "setboard")){ engineSide = NONE; stm = Setup(inBuf+9); return 1; }
- if(!strcmp(command, "undo")) { TakeBack(1); return 1; }
- if(!strcmp(command, "remove")) { TakeBack(2); return 1; }
+ if(!strcmp(command, "setboard")){ engineSide = NONE; stm = Setup(inBuf+9); MapClear(0); return 1; }
+ if(!strcmp(command, "undo")) { TakeBack(1); MapClear(0); return 1; }
+ if(!strcmp(command, "remove")) { TakeBack(2); MapClear(0); return 1; }
if(!strcmp(command, "go")) { engineSide = stm; return 1; }
if(!strcmp(command, "hint")) { if(ponderMove != INVALID) printf("Hint: %s\n", MoveToText(ponderMove)); return 1; }
+ if(!strcmp(command, "include")) { if(inBuf[9] == 'l') MapClear(0); else moveMap[ParseMove(stm, inBuf+8)] = 0; return 1; }
+ if(!strcmp(command, "exclude")) { if(inBuf[9] == 'l') MapClear(1); else moveMap[ParseMove(stm, inBuf+8)] = 1; return 1; }
if(!strcmp(command, "book")) { return 1; }
// completely ignored commands:
if(!strcmp(command, "xboard")) { return 1; }
if(move == INVALID) printf("Illegal move\n");
else if(!RootMakeMove(move)) printf("Illegal move\n");
else {
- ponderMove = INVALID;
+ ponderMove = INVALID; MapClear(0);
}
return 1;
}