mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 17:19:36 +00:00
Remove redundant argument from hidden_checkers()
No functional change.
This commit is contained in:
parent
e6c9ce6358
commit
342fd6385b
2 changed files with 9 additions and 8 deletions
|
@ -415,20 +415,21 @@ const string Position::pretty(Move move) const {
|
||||||
/// pieces, according to the call parameters. Pinned pieces protect our king and
|
/// pieces, according to the call parameters. Pinned pieces protect our king and
|
||||||
/// discovered check pieces attack the enemy king.
|
/// discovered check pieces attack the enemy king.
|
||||||
|
|
||||||
Bitboard Position::hidden_checkers(Square ksq, Color c, Color toMove) const {
|
Bitboard Position::hidden_checkers(Color c, Color kingColor) const {
|
||||||
|
|
||||||
Bitboard b, pinners, result = 0;
|
Bitboard b, pinners, result = 0;
|
||||||
|
Square ksq = king_square(kingColor);
|
||||||
|
|
||||||
// Pinners are sliders that give check when a pinned piece is removed
|
// Pinners are sliders that give check when a pinned piece is removed
|
||||||
pinners = ( (pieces( ROOK, QUEEN) & PseudoAttacks[ROOK ][ksq])
|
pinners = ( (pieces( ROOK, QUEEN) & PseudoAttacks[ROOK ][ksq])
|
||||||
| (pieces(BISHOP, QUEEN) & PseudoAttacks[BISHOP][ksq])) & pieces(c);
|
| (pieces(BISHOP, QUEEN) & PseudoAttacks[BISHOP][ksq])) & pieces(~kingColor);
|
||||||
|
|
||||||
while (pinners)
|
while (pinners)
|
||||||
{
|
{
|
||||||
b = between_bb(ksq, pop_lsb(&pinners)) & pieces();
|
b = between_bb(ksq, pop_lsb(&pinners)) & pieces();
|
||||||
|
|
||||||
if (!more_than_one(b))
|
if (!more_than_one(b))
|
||||||
result |= b & pieces(toMove);
|
result |= b & pieces(c);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ public:
|
||||||
// Checking
|
// Checking
|
||||||
Bitboard checkers() const;
|
Bitboard checkers() const;
|
||||||
Bitboard discovered_check_candidates() const;
|
Bitboard discovered_check_candidates() const;
|
||||||
Bitboard pinned_pieces(Color toMove) const;
|
Bitboard pinned_pieces(Color c) const;
|
||||||
|
|
||||||
// Attacks to/from a given square
|
// Attacks to/from a given square
|
||||||
Bitboard attackers_to(Square s) const;
|
Bitboard attackers_to(Square s) const;
|
||||||
|
@ -174,7 +174,7 @@ private:
|
||||||
|
|
||||||
// Helper functions
|
// Helper functions
|
||||||
void do_castling(Square kfrom, Square kto, Square rfrom, Square rto);
|
void do_castling(Square kfrom, Square kto, Square rfrom, Square rto);
|
||||||
Bitboard hidden_checkers(Square ksq, Color c, Color toMove) const;
|
Bitboard hidden_checkers(Color c, Color kingColor) const;
|
||||||
void put_piece(Square s, Color c, PieceType pt);
|
void put_piece(Square s, Color c, PieceType pt);
|
||||||
void remove_piece(Square s, Color c, PieceType pt);
|
void remove_piece(Square s, Color c, PieceType pt);
|
||||||
void move_piece(Square from, Square to, Color c, PieceType pt);
|
void move_piece(Square from, Square to, Color c, PieceType pt);
|
||||||
|
@ -315,11 +315,11 @@ inline Bitboard Position::checkers() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Bitboard Position::discovered_check_candidates() const {
|
inline Bitboard Position::discovered_check_candidates() const {
|
||||||
return hidden_checkers(king_square(~sideToMove), sideToMove, sideToMove);
|
return hidden_checkers(sideToMove, ~sideToMove);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Bitboard Position::pinned_pieces(Color toMove) const {
|
inline Bitboard Position::pinned_pieces(Color c) const {
|
||||||
return hidden_checkers(king_square(toMove), ~toMove, toMove);
|
return hidden_checkers(c, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Position::pawn_passed(Color c, Square s) const {
|
inline bool Position::pawn_passed(Color c, Square s) const {
|
||||||
|
|
Loading…
Add table
Reference in a new issue