if (m)\r
/* doesn't have move syntax */\r
printf("Error (unknown command): %s\n", command);\r
- else { int i=K;\r
+ else { int i=-1;\r
if(b[L] && (b[L]&16) == Side && w[b[L]&15] < 0) // capture own King: castling\r
- { K = L; L = i>L ? i-1 : i+2; }\r
+ { i=K; K = L; L = i>L ? i-1 : i+2; }\r
if(D(Side,-I,I,Q,O,LL|S,3)!=I) {\r
/* did have move syntax, but illegal move */\r
printf("Illegal move:%s\n", line);\r
- } else { /* legal move, perform it */\r
+ } else { /* legal move, perform it */
+ if(i >= 0) b[i]=b[K],b[K]=0; // reverse Seirawan gating\r
GameHistory[GamePtr++] = PACK_MOVE;\r
Side ^= BLACK^WHITE;\r
CopyBoard(HistPtr=HistPtr+1&1023);\r