X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=e1d05f614738c52c485606a94526ec2a2e8e3b76;hp=e32f8f4973cf4e06f913067baae7e4f38d014318;hb=8b5519a009914b07ad73a71f86dc0e9ff52b99da;hpb=f036239521fe4f6afb7e8cbc51d860ffa476f6bd diff --git a/src/position.cpp b/src/position.cpp index e32f8f49..e1d05f61 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -385,8 +385,8 @@ bool Position::square_is_attacked(Square s, Color c) const { Bitboard Position::attacks_to(Square s) const { return - (black_pawn_attacks(s) & pawns(WHITE)) | - (white_pawn_attacks(s) & pawns(BLACK)) | + (pawn_attacks(BLACK, s) & pawns(WHITE)) | + (pawn_attacks(WHITE, s) & pawns(BLACK)) | (piece_attacks(s) & pieces_of_type(KNIGHT)) | (piece_attacks(s) & rooks_and_queens()) | (piece_attacks(s) & bishops_and_queens()) | @@ -408,11 +408,11 @@ bool Position::piece_attacks_square(Square f, Square t) const { switch(piece_on(f)) { case WP: return white_pawn_attacks_square(f, t); case BP: return black_pawn_attacks_square(f, t); - case WN: case BN: return knight_attacks_square(f, t); - case WB: case BB: return bishop_attacks_square(f, t); - case WR: case BR: return rook_attacks_square(f, t); - case WQ: case BQ: return queen_attacks_square(f, t); - case WK: case BK: return king_attacks_square(f, t); + case WN: case BN: return piece_attacks_square(f, t); + case WB: case BB: return piece_attacks_square(f, t); + case WR: case BR: return piece_attacks_square(f, t); + case WQ: case BQ: return piece_attacks_square(f, t); + case WK: case BK: return piece_attacks_square(f, t); default: return false; } @@ -549,7 +549,7 @@ bool Position::move_is_check(Move m, Bitboard dcCandidates) const { switch(move_promotion(m)) { case KNIGHT: - return knight_attacks_square(to, ksq); + return piece_attacks_square(to, ksq); case BISHOP: return bit_is_set(bishop_attacks_bb(to, b), ksq); case ROOK: @@ -670,11 +670,11 @@ bool Position::move_attacks_square(Move m, Square s) const { switch(piece_on(f)) { case WP: return white_pawn_attacks_square(t, s); case BP: return black_pawn_attacks_square(t, s); - case WN: case BN: return knight_attacks_square(t, s); - case WB: case BB: return bishop_attacks_square(t, s); - case WR: case BR: return rook_attacks_square(t, s); - case WQ: case BQ: return queen_attacks_square(t, s); - case WK: case BK: return king_attacks_square(t, s); + case WN: case BN: return piece_attacks_square(t, s); + case WB: case BB: return piece_attacks_square(t, s); + case WR: case BR: return piece_attacks_square(t, s); + case WQ: case BQ: return piece_attacks_square(t, s); + case WK: case BK: return piece_attacks_square(t, s); default: assert(false); } @@ -847,9 +847,9 @@ void Position::do_move(Move m, UndoInfo &u, Bitboard dcCandidates) { } if(piece == PAWN) { if(abs(int(to) - int(from)) == 16) { - if((us == WHITE && (white_pawn_attacks(from + DELTA_N) & + if((us == WHITE && (pawn_attacks(WHITE, from + DELTA_N) & pawns(BLACK))) || - (us == BLACK && (black_pawn_attacks(from + DELTA_S) & + (us == BLACK && (pawn_attacks(BLACK, from + DELTA_S) & pawns(WHITE)))) { epSquare = Square((int(from) + int(to)) / 2); key ^= zobEp[epSquare]; @@ -1632,8 +1632,8 @@ int Position::see(Square from, Square to) const { (bishop_attacks_bb(to, occ) & bishops_and_queens()) | (piece_attacks(to) & knights()) | (piece_attacks(to) & kings()) | - (white_pawn_attacks(to) & pawns(BLACK)) | - (black_pawn_attacks(to) & pawns(WHITE)); + (pawn_attacks(WHITE, to) & pawns(BLACK)) | + (pawn_attacks(BLACK, to) & pawns(WHITE)); attackers &= occ; // If the opponent has no attackers, we are finished: