fixed en passant capture
This commit is contained in:
parent
310abb0611
commit
4eaed699c0
@ -32,14 +32,15 @@ std::vector<Move> pawn_moves(const Board& b, const Coords xy) {
|
|||||||
// -- Capture en passant
|
// -- Capture en passant
|
||||||
if (b.en_passant_target != -1) {
|
if (b.en_passant_target != -1) {
|
||||||
Coords c = Coords::from_index(b.en_passant_target);
|
Coords c = Coords::from_index(b.en_passant_target);
|
||||||
int dy = my_colour == Colour::White ? -1 : 1;
|
int dy = my_colour == Colour::White ? 1 : -1;
|
||||||
if (c.y == xy.y + dy && (c.x == xy.x - 1 || c.x == xy.x + 1))
|
if (c.y == xy.y + dy && (c.x == xy.x - 1 || c.x == xy.x + 1)) {
|
||||||
ret.push_back(Move{
|
ret.push_back(Move{
|
||||||
xy.to_index(),
|
xy.to_index(),
|
||||||
c.to_index(),
|
c.to_index(),
|
||||||
.is_capturing = true,
|
.is_capturing = true,
|
||||||
.en_passant = true
|
.en_passant = true
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- Normal move + promotion
|
// -- Normal move + promotion
|
||||||
|
Loading…
x
Reference in New Issue
Block a user