From 178720867b5f21ece6bde4502d0d249f532f6a7f Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 22 Nov 2010 13:20:37 +0100 Subject: [PATCH] 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. --- fairymax.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) 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); -- 1.7.0.4