if(name[1]) name[1] += 'A' - 'a';\r
} else color = WHITE;\r
p1 = LookUp(name, var);\r
+ if(!p1) printf("tellusererror Unknown piece '%s' in setup\n", name), exit(-1);\r
if(pflag && p1->promoted) p1 = LookUp(p1->promoted, var); // use promoted piece instead\r
n = AddPiece(color, p1);\r
p[n].pos = j;\r
#define OFF 0\r
#define ON 1\r
\r
-#define DEFAULT_FEN ""\r
-\r
typedef Move MOVE;\r
\r
int moveNr; // part of game state; incremented by MakeMove\r
if(isalpha(*fen)) {\r
char *table = fenNames;\r
n = *fen > 'Z' ? 'a' - 'A' : 0;\r
- if(table[2* (*fen - 'A' - n)] == '.') *p++ = *fen; else {\r
+ if(currentVariant == V_CHESS && *fen - 'A' - n == 'N' // In Chess N is Knight, not Lion\r
+ || table[2* (*fen - 'A' - n)] == '.') *p++ = *fen; else {\r
*p++ = ':';\r
*p++ = table[2* (*fen - 'A' - n)] + n;\r
*p++ = table[2* (*fen - 'A' - n)+1] + n;\r
int TakeBack(int n)\r
{ // reset the game and then replay it to the desired point\r
int last, stm;\r
- stm = Setup2(NULL);\r
+ Init(currentVariant); stm = Setup2(NULL);\r
printf("# setup done");fflush(stdout);\r
last = moveNr - n; if(last < 0) last = 0;\r
for(moveNr=0; moveNr<last; moveNr++) stm = MakeMove2(stm, gameMove[moveNr]),printf("make %2d: %x\n", moveNr, gameMove[moveNr]);\r
if(!strcmp(command, "ping")) { printf("pong%s", inBuf+4); continue; }\r
// if(!strcmp(command, "")) { sscanf(inBuf, " %d", &); continue; }\r
if(!strcmp(command, "new")) {\r
- engineSide = BLACK; Init(V_CHESS); stm = Setup2(DEFAULT_FEN); maxDepth = MAXPLY; randomize = OFF; comp = 0;\r
+ engineSide = BLACK; Init(V_CHESS); stm = Setup2(NULL); maxDepth = MAXPLY; randomize = OFF; comp = 0;\r
continue;\r
}\r
- if(!strcmp(command, "setboard")){ engineSide = NONE; stm = Setup2(inBuf+9); continue; }\r
+ if(!strcmp(command, "setboard")){ engineSide = NONE; Init(currentVariant); stm = Setup2(inBuf+9); continue; }\r
if(!strcmp(command, "easy")) { ponder = OFF; continue; }\r
if(!strcmp(command, "hard")) { ponder = ON; continue; }\r
if(!strcmp(command, "undo")) { stm = TakeBack(1); continue; }\r