Introduction
Introduction Statistics Contact Development Disclaimer Help
fen.c: improve castling with chess960 - chess-puzzles - chess puzzle book gener…
git clone git://git.codemadness.org/chess-puzzles
Log
Files
Refs
README
LICENSE
---
commit 7915ffd10d87934201c751632a4e1dd4c3cb65cb
parent 37c4fe7bb023a2537fd8221042a9b62086c6532b
Author: Hiltjo Posthuma <[email protected]>
Date: Mon, 22 Jan 2024 00:55:02 +0100
fen.c: improve castling with chess960
Diffstat:
M fen.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/fen.c b/fen.c
@@ -1173,7 +1173,7 @@ board_playmoves(struct board *b, const char *moves)
/* castling */
if (piece == 'K' && y == 7 && y2 == 7) {
/* white: kingside castling */
- if (x2 > x + 1 || takepiece == 'R') {
+ if (x2 > x + 1 || (x2 > x && takepiece == 'R')) {
for (i = x2; i < 8; i++) {
if (getpiece(b, i, y2) == 'R') {
place(b, 0, x, y); /* clear pr…
@@ -1183,7 +1183,7 @@ board_playmoves(struct board *b, const char *moves)
break;
}
}
- } else if (x2 < x - 1 || takepiece == 'R') {
+ } else if (x2 < x - 1 || (x2 < x && takepiece == 'R'))…
/* white: queenside castling */
for (i = x2; i >= 0; i--) {
if (getpiece(b, i, y2) == 'R') {
@@ -1197,7 +1197,7 @@ board_playmoves(struct board *b, const char *moves)
}
} else if (piece == 'k' && y == 0 && y2 == 0) {
/* black: kingside castling */
- if (x2 > x + 1 || takepiece == 'r') {
+ if (x2 > x + 1 || (x2 > x && takepiece == 'r')) {
for (i = x2; i < 8; i++) {
if (getpiece(b, i, y2) == 'r') {
place(b, 0, x, y); /* clear pr…
@@ -1207,7 +1207,7 @@ board_playmoves(struct board *b, const char *moves)
break;
}
}
- } else if (x2 < x - 1 || takepiece == 'r') {
+ } else if (x2 < x - 1 || (x2 < x && takepiece == 'r'))…
/* black: queenside castling */
for (i = x2; i >= 0; i--) {
if (getpiece(b, i, y2) == 'r') {
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.