fen.c: improve more subtle things in chess960 castling - chess-puzzles - chess … | |
git clone git://git.codemadness.org/chess-puzzles | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 5bf484cc8a074778fe73a54541288119dd207822 | |
parent 34e46a6fdd7cddde422a6b75c285879951d540e9 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Mon, 22 Jan 2024 01:36:43 +0100 | |
fen.c: improve more subtle things in chess960 castling | |
Diffstat: | |
M fen.c | 12 ++++++------ | |
1 file changed, 6 insertions(+), 6 deletions(-) | |
--- | |
diff --git a/fen.c b/fen.c | |
@@ -1178,27 +1178,27 @@ board_playmoves(struct board *b, const char *moves) | |
/* kingside castling */ | |
if (x2 > x + 1 || (x2 > x && takepiece == rookpiece)) { | |
- for (i = x2; i < 8; i++) { | |
+ castled = "O-O"; | |
+ for (i = x; i < 8; i++) { | |
if (getpiece(b, i, y2) == rookpiece) { | |
place(b, 0, x, y); /* clear pr… | |
place(b, 0, i, y2); /* clear r… | |
place(b, rookpiece, x2 - 1, y2… | |
place(b, piece, x2, y2); /* pl… | |
- x2 = i; /* set square for high… | |
- castled = "O-O"; | |
+ x2 = i; /* update square for h… | |
break; | |
} | |
} | |
} else if (x2 < x - 1 || (x2 < x && takepiece == rookp… | |
/* queenside castling */ | |
- for (i = x2; i >= 0; i--) { | |
+ castled = "O-O-O"; | |
+ for (i = x; i >= 0; i--) { | |
if (getpiece(b, i, y2) == rookpiece) { | |
place(b, 0, x, y); /* clear pr… | |
place(b, 0, i, y2); /* clear r… | |
place(b, rookpiece, x2 + 1, y2… | |
place(b, piece, x2, y2); /* pl… | |
- x2 = i; /* set square for high… | |
- castled = "O-O-O"; | |
+ x2 = i; /* update square for h… | |
break; | |
} | |
} |