summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2017-05-28 17:40:43 -0400
committerFranklin Wei <me@fwei.tk>2017-05-28 17:40:43 -0400
commit988afccc360e6e1e22161ccc63518fc253c6b1f7 (patch)
tree928280d5491753a1537c4e5a4f809d3bbd110afa
parent0bbdcc8bd920421b19f4d25d416d8c3f1ae13cda (diff)
downloadxenonchess-988afccc360e6e1e22161ccc63518fc253c6b1f7.zip
xenonchess-988afccc360e6e1e22161ccc63518fc253c6b1f7.tar.gz
xenonchess-988afccc360e6e1e22161ccc63518fc253c6b1f7.tar.bz2
xenonchess-988afccc360e6e1e22161ccc63518fc253c6b1f7.tar.xz
fix en passant bug
-rw-r--r--chess.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/chess.c b/chess.c
index f27673f..a0e2e41 100644
--- a/chess.c
+++ b/chess.c
@@ -546,12 +546,12 @@ void for_each_move(const struct chess_ctx *ctx,
int opp = piece->color == WHITE ? 1 : 0;
if(valid_coords(y + dy, x + 1) && ctx->en_passant[opp][x + 1])
{
- if(!gen_and_call(ctx, y + dy, x, dy, 1, cb, data, enforce_check))
+ if(!gen_and_call(ctx, y, x, dy, 1, cb, data, enforce_check))
return;
}
if(valid_coords(y + dy, x - 1) && ctx->en_passant[opp][x - 1])
{
- if(!gen_and_call(ctx, y + dy, x, dy, -1, cb, data, enforce_check))
+ if(!gen_and_call(ctx, y, x, dy, -1, cb, data, enforce_check))
return;
}
}