mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Rename square_empty() to is_empty()
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
e8d89ca5b0
commit
456f37b8ab
3 changed files with 17 additions and 17 deletions
|
@ -614,7 +614,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
|
||||||
Square d = pawn_push(Us) + (file_of(s) == FILE_A ? DELTA_E : DELTA_W);
|
Square d = pawn_push(Us) + (file_of(s) == FILE_A ? DELTA_E : DELTA_W);
|
||||||
if (pos.piece_on(s + d) == make_piece(Us, PAWN))
|
if (pos.piece_on(s + d) == make_piece(Us, PAWN))
|
||||||
{
|
{
|
||||||
if (!pos.square_empty(s + d + pawn_push(Us)))
|
if (!pos.is_empty(s + d + pawn_push(Us)))
|
||||||
score -= 2*TrappedBishopA1H1Penalty;
|
score -= 2*TrappedBishopA1H1Penalty;
|
||||||
else if (pos.piece_on(s + 2*d) == make_piece(Us, PAWN))
|
else if (pos.piece_on(s + 2*d) == make_piece(Us, PAWN))
|
||||||
score -= TrappedBishopA1H1Penalty;
|
score -= TrappedBishopA1H1Penalty;
|
||||||
|
@ -894,7 +894,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
|
||||||
ebonus -= Value(square_distance(pos.king_square(Us), blockSq + pawn_push(Us)) * rr);
|
ebonus -= Value(square_distance(pos.king_square(Us), blockSq + pawn_push(Us)) * rr);
|
||||||
|
|
||||||
// If the pawn is free to advance, increase bonus
|
// If the pawn is free to advance, increase bonus
|
||||||
if (pos.square_empty(blockSq))
|
if (pos.is_empty(blockSq))
|
||||||
{
|
{
|
||||||
squaresToQueen = forward_bb(Us, s);
|
squaresToQueen = forward_bb(Us, s);
|
||||||
defendedSquares = squaresToQueen & ei.attackedBy[Us][0];
|
defendedSquares = squaresToQueen & ei.attackedBy[Us][0];
|
||||||
|
|
|
@ -270,7 +270,7 @@ const string Position::to_fen() const {
|
||||||
{
|
{
|
||||||
sq = make_square(file, rank);
|
sq = make_square(file, rank);
|
||||||
|
|
||||||
if (square_empty(sq))
|
if (is_empty(sq))
|
||||||
emptyCnt++;
|
emptyCnt++;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -421,7 +421,7 @@ bool Position::move_attacks_square(Move m, Square s) const {
|
||||||
Square to = to_sq(m);
|
Square to = to_sq(m);
|
||||||
Piece piece = piece_moved(m);
|
Piece piece = piece_moved(m);
|
||||||
|
|
||||||
assert(!square_empty(from));
|
assert(!is_empty(from));
|
||||||
|
|
||||||
// Update occupancy as if the piece is moving
|
// Update occupancy as if the piece is moving
|
||||||
occ = pieces() ^ from ^ to;
|
occ = pieces() ^ from ^ to;
|
||||||
|
@ -563,7 +563,7 @@ bool Position::is_pseudo_legal(const Move m) const {
|
||||||
case DELTA_N:
|
case DELTA_N:
|
||||||
case DELTA_S:
|
case DELTA_S:
|
||||||
// Pawn push. The destination square must be empty.
|
// Pawn push. The destination square must be empty.
|
||||||
if (!square_empty(to))
|
if (!is_empty(to))
|
||||||
return false;
|
return false;
|
||||||
break;
|
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
|
// Double white pawn push. The destination square must be on the fourth
|
||||||
// rank, and both the destination square and the square between the
|
// rank, and both the destination square and the square between the
|
||||||
// source and destination squares must be empty.
|
// source and destination squares must be empty.
|
||||||
if ( rank_of(to) != RANK_4
|
if ( rank_of(to) != RANK_4
|
||||||
|| !square_empty(to)
|
|| !is_empty(to)
|
||||||
|| !square_empty(from + DELTA_N))
|
|| !is_empty(from + DELTA_N))
|
||||||
return false;
|
return false;
|
||||||
break;
|
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
|
// Double black pawn push. The destination square must be on the fifth
|
||||||
// rank, and both the destination square and the square between the
|
// rank, and both the destination square and the square between the
|
||||||
// source and destination squares must be empty.
|
// source and destination squares must be empty.
|
||||||
if ( rank_of(to) != RANK_5
|
if ( rank_of(to) != RANK_5
|
||||||
|| !square_empty(to)
|
|| !is_empty(to)
|
||||||
|| !square_empty(from + DELTA_S))
|
|| !is_empty(from + DELTA_S))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -956,7 +956,7 @@ void Position::undo_move(Move m) {
|
||||||
PieceType pt = type_of(piece);
|
PieceType pt = type_of(piece);
|
||||||
PieceType capture = st->capturedType;
|
PieceType capture = st->capturedType;
|
||||||
|
|
||||||
assert(square_empty(from));
|
assert(is_empty(from));
|
||||||
assert(color_of(piece) == us);
|
assert(color_of(piece) == us);
|
||||||
assert(capture != KING);
|
assert(capture != KING);
|
||||||
|
|
||||||
|
@ -1527,7 +1527,7 @@ void Position::flip() {
|
||||||
startPosPly = pos.startpos_ply_counter();
|
startPosPly = pos.startpos_ply_counter();
|
||||||
|
|
||||||
for (Square s = SQ_A1; s <= SQ_H8; s++)
|
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);
|
put_piece(Piece(pos.piece_on(s) ^ 8), ~s);
|
||||||
|
|
||||||
if (pos.can_castle(WHITE_OO))
|
if (pos.can_castle(WHITE_OO))
|
||||||
|
|
|
@ -106,7 +106,7 @@ public:
|
||||||
Piece piece_on(Square s) const;
|
Piece piece_on(Square s) const;
|
||||||
Square king_square(Color c) const;
|
Square king_square(Color c) const;
|
||||||
Square ep_square() const;
|
Square ep_square() const;
|
||||||
bool square_empty(Square s) const;
|
bool is_empty(Square s) const;
|
||||||
const Square* piece_list(Color c, PieceType pt) const;
|
const Square* piece_list(Color c, PieceType pt) const;
|
||||||
int piece_count(Color c, PieceType pt) const;
|
int piece_count(Color c, PieceType pt) const;
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ inline Piece Position::piece_moved(Move m) const {
|
||||||
return board[from_sq(m)];
|
return board[from_sq(m)];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Position::square_empty(Square s) const {
|
inline bool Position::is_empty(Square s) const {
|
||||||
return board[s] == NO_PIECE;
|
return board[s] == NO_PIECE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,14 +416,14 @@ inline bool Position::is_chess960() const {
|
||||||
inline bool Position::is_capture_or_promotion(Move m) const {
|
inline bool Position::is_capture_or_promotion(Move m) const {
|
||||||
|
|
||||||
assert(is_ok(m));
|
assert(is_ok(m));
|
||||||
return is_special(m) ? !is_castle(m) : !square_empty(to_sq(m));
|
return is_special(m) ? !is_castle(m) : !is_empty(to_sq(m));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Position::is_capture(Move m) const {
|
inline bool Position::is_capture(Move m) const {
|
||||||
|
|
||||||
// Note that castle is coded as "king captures the rook"
|
// Note that castle is coded as "king captures the rook"
|
||||||
assert(is_ok(m));
|
assert(is_ok(m));
|
||||||
return (!square_empty(to_sq(m)) && !is_castle(m)) || is_enpassant(m);
|
return (!is_empty(to_sq(m)) && !is_castle(m)) || is_enpassant(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PieceType Position::captured_piece_type() const {
|
inline PieceType Position::captured_piece_type() const {
|
||||||
|
|
Loading…
Add table
Reference in a new issue