diff --git a/cpp/src/board.cpp b/cpp/src/board.cpp index 95848ad..8cc5a55 100644 --- a/cpp/src/board.cpp +++ b/cpp/src/board.cpp @@ -182,7 +182,9 @@ Board Board::make_move(Move move) const { ret.squares[move.target_square] = this->squares[move.source_square]; // -- Handle en passant target being eaten - if (move.en_passant) + if (en_passant_target != -1 + && (squares[move.source_square] & 0b111) == Piece::Pawn + && squares[move.target_square] == Piece::None) ret.squares[move.target_square + (white_to_play ? -8 : 8)] = Piece::None; diff --git a/cpp/src/main.cpp b/cpp/src/main.cpp index 69872fd..6594994 100644 --- a/cpp/src/main.cpp +++ b/cpp/src/main.cpp @@ -7,6 +7,6 @@ int main(int argc, char* argv[]) { std::string pos = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; // Board b = Board::setup_fen_position(pos); - perft(pos); + perft(); return 0; } diff --git a/cpp/src/move.hpp b/cpp/src/move.hpp index 8b1cd72..0aa9416 100644 --- a/cpp/src/move.hpp +++ b/cpp/src/move.hpp @@ -13,7 +13,7 @@ struct Move { // bool is_capturing = false; // CastleSide castle_side = CastleSide::NeitherSide; - bool en_passant = false; + // bool en_passant = false; int8_t promoting_to = Piece::None; std::string to_string() const { diff --git a/cpp/src/pieces/pawn.cpp b/cpp/src/pieces/pawn.cpp index c7e087f..c5e6487 100644 --- a/cpp/src/pieces/pawn.cpp +++ b/cpp/src/pieces/pawn.cpp @@ -53,10 +53,8 @@ std::vector pawn_moves(const Board& b, const Coords xy) { if (b.en_passant_target != -1) { Coords c = Coords::from_index(b.en_passant_target); int dy = my_colour == Colour::White ? 1 : -1; - if (c.y == xy.y + dy && (c.x == xy.x - 1 || c.x == xy.x + 1)) { - ret.push_back(Move{xy.to_index(), c.to_index(), .en_passant = true} - ); - } + if (c.y == xy.y + dy && (c.x == xy.x - 1 || c.x == xy.x + 1)) + ret.push_back(Move{xy.to_index(), c.to_index()}); } // -- Normal move + promotion