removed en passant from move
This commit is contained in:
parent
a658673d2b
commit
f768d16a7e
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -53,10 +53,8 @@ std::vector<Move> 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user