From: H.G. Muller Date: Mon, 22 Nov 2010 11:52:02 +0000 (+0100) Subject: Allow RxK notation for entering castling X-Git-Tag: 4.8Q~7 X-Git-Url: http://winboard.nl/cgi-bin?p=fairymax.git;a=commitdiff_plain;h=4b753a4ed5a531703e7456cb92f21b9a0f46b4e3 Allow RxK notation for entering castling This notation is detected on input, and translated to the corresponding King move, where the to-square is derved from the entered 'Rook' position, so that capturing with wrongly positioned pieces would be rejected as illegal. (They might be accepted as normal King moves, though.) --- diff --git a/fairymax.c b/fairymax.c index ce2d7ae..7fb3cad 100644 --- a/fairymax.c +++ b/fairymax.c @@ -859,14 +859,18 @@ int main(int argc, char **argv) if (m) /* doesn't have move syntax */ printf("Error (unknown command): %s\n", command); - else if(D(Side,-I,I,Q,O,LL|S,3)!=I) { + else { int i=K; + 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; } + 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 */ GameHistory[GamePtr++] = PACK_MOVE; Side ^= BLACK^WHITE; CopyBoard(HistPtr=HistPtr+1&1023); if(PrintResult(Side)) Computer = EMPTY; + } } } }