From: H.G. Muller Date: Mon, 22 Nov 2010 12:20:37 +0000 (+0100) Subject: Allow Seirawan gating on Rook square when castling X-Git-Tag: 4.8Q~6 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=178720867b5f21ece6bde4502d0d249f532f6a7f;hp=4b753a4ed5a531703e7456cb92f21b9a0f46b4e3;p=fairymax.git Allow Seirawan gating on Rook square when castling The reverse castling notation (RxK) can be used to indicate this, as WB protocol prescribes. Implemented by simply moving the contents of the old K square to the old R square when a KxR notation is detected. --- diff --git a/fairymax.c b/fairymax.c index 7fb3cad..0f4dd5f 100644 --- a/fairymax.c +++ b/fairymax.c @@ -859,13 +859,14 @@ int main(int argc, char **argv) if (m) /* doesn't have move syntax */ printf("Error (unknown command): %s\n", command); - else { int i=K; + else { int i=-1; if(b[L] && (b[L]&16) == Side && w[b[L]&15] < 0) // capture own King: castling - { K = L; L = i>L ? i-1 : i+2; } + { i=K; K = L; L = i>L ? i-1 : i+2; } if(D(Side,-I,I,Q,O,LL|S,3)!=I) { /* did have move syntax, but illegal move */ printf("Illegal move:%s\n", line); - } else { /* legal move, perform it */ + } else { /* legal move, perform it */ + if(i >= 0) b[i]=b[K],b[K]=0; // reverse Seirawan gating GameHistory[GamePtr++] = PACK_MOVE; Side ^= BLACK^WHITE; CopyBoard(HistPtr=HistPtr+1&1023);