X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=7f997bb776376874a36c882c206c8a57b4ce1147;hp=e5e0ab06d6eff97946b800ae8ff7bbf159cfa198;hb=96f4ab48d8b2e3129a2d028f7739f12db2200667;hpb=d66b765eb6b3725b468a3c5f8f2cdb9693fd6bdf diff --git a/src/position.cpp b/src/position.cpp index e5e0ab06..7f997bb7 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -270,7 +270,7 @@ const string Position::to_fen() const { { sq = make_square(file, rank); - if (square_empty(sq)) + if (is_empty(sq)) emptyCnt++; else { @@ -364,9 +364,9 @@ Bitboard Position::hidden_checkers() const { while (pinners) { - b = squares_between(ksq, pop_1st_bit(&pinners)) & pieces(); + b = between_bb(ksq, pop_1st_bit(&pinners)) & pieces(); - if (b && single_bit(b) && (b & pieces(sideToMove))) + if (b && !more_than_one(b) && (b & pieces(sideToMove))) result |= b; } return result; @@ -421,7 +421,7 @@ bool Position::move_attacks_square(Move m, Square s) const { Square to = to_sq(m); Piece piece = piece_moved(m); - assert(!square_empty(from)); + assert(!is_empty(from)); // Update occupancy as if the piece is moving occ = pieces() ^ from ^ to; @@ -563,7 +563,7 @@ bool Position::is_pseudo_legal(const Move m) const { case DELTA_N: case DELTA_S: // Pawn push. The destination square must be empty. - if (!square_empty(to)) + if (!is_empty(to)) return false; break; @@ -571,9 +571,9 @@ bool Position::is_pseudo_legal(const Move m) const { // Double white pawn push. The destination square must be on the fourth // rank, and both the destination square and the square between the // source and destination squares must be empty. - if ( rank_of(to) != RANK_4 - || !square_empty(to) - || !square_empty(from + DELTA_N)) + if ( rank_of(to) != RANK_4 + || !is_empty(to) + || !is_empty(from + DELTA_N)) return false; break; @@ -581,9 +581,9 @@ bool Position::is_pseudo_legal(const Move m) const { // Double black pawn push. The destination square must be on the fifth // rank, and both the destination square and the square between the // source and destination squares must be empty. - if ( rank_of(to) != RANK_5 - || !square_empty(to) - || !square_empty(from + DELTA_S)) + if ( rank_of(to) != RANK_5 + || !is_empty(to) + || !is_empty(from + DELTA_S)) return false; break; @@ -608,7 +608,7 @@ bool Position::is_pseudo_legal(const Move m) const { return false; // Our move must be a blocking evasion or a capture of the checking piece - if (!((squares_between(checksq, king_square(us)) | checkers()) & to)) + if (!((between_bb(checksq, king_square(us)) | checkers()) & to)) return false; } // In case of king moves under check we have to remove king so to catch @@ -641,7 +641,7 @@ bool Position::move_gives_check(Move m, const CheckInfo& ci) const { if (ci.dcCandidates && (ci.dcCandidates & from)) { // For pawn and king moves we need to verify also direction - if ( (pt != PAWN && pt != KING) + if ( (pt != PAWN && pt != KING) || !squares_aligned(from, to, king_square(~sideToMove))) return true; } @@ -956,7 +956,7 @@ void Position::undo_move(Move m) { PieceType pt = type_of(piece); PieceType capture = st->capturedType; - assert(square_empty(from)); + assert(is_empty(from)); assert(color_of(piece) == us); assert(capture != KING); @@ -1527,7 +1527,7 @@ void Position::flip() { startPosPly = pos.startpos_ply_counter(); for (Square s = SQ_A1; s <= SQ_H8; s++) - if (!pos.square_empty(s)) + if (!pos.is_empty(s)) put_piece(Piece(pos.piece_on(s) ^ 8), ~s); if (pos.can_castle(WHITE_OO))