static void init();
// Text input/output
- void set(const std::string& fen, bool isChess960, Thread* th);
+ void set(const std::string& fenStr, bool isChess960, Thread* th);
const std::string fen() const;
const std::string pretty(Move m = MOVE_NONE) const;
// Checking
Bitboard checkers() const;
Bitboard discovered_check_candidates() const;
- Bitboard pinned_pieces(Color toMove) const;
+ Bitboard pinned_pieces(Color c) const;
// Attacks to/from a given square
Bitboard attackers_to(Square s) const;
bool capture(Move m) const;
bool capture_or_promotion(Move m) const;
bool gives_check(Move m, const CheckInfo& ci) const;
- bool passed_pawn_push(Move m) const;
+ bool advanced_pawn_push(Move m) const;
Piece moved_piece(Move m) const;
PieceType captured_piece_type() const;
// Helper functions
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 remove_piece(Square s, Color c, PieceType pt);
void move_piece(Square from, Square to, Color c, PieceType pt);
}
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 {
- return hidden_checkers(king_square(toMove), ~toMove, toMove);
+inline Bitboard Position::pinned_pieces(Color c) const {
+ return hidden_checkers(c, c);
}
inline bool Position::pawn_passed(Color c, Square s) const {
return !(pieces(~c, PAWN) & passed_pawn_mask(c, s));
}
-inline bool Position::passed_pawn_push(Move m) const {
-
+inline bool Position::advanced_pawn_push(Move m) const {
return type_of(moved_piece(m)) == PAWN
- && pawn_passed(sideToMove, to_sq(m));
+ && relative_rank(sideToMove, from_sq(m)) > RANK_4;
}
inline Key Position::key() const {