Skip to content

Commit

Permalink
Merge branch 'check-evasions' into move-legal-pre
Browse files Browse the repository at this point in the history
  • Loading branch information
alex65536 committed Aug 6, 2023
2 parents 90674d0 + 458ef63 commit 5456822
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/core/movegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ inline bool isCellAttacked(const Board &b, const coord_t coord, const Color c) {
template <Color C>
bitboard_t cellAttackers(const Board &b, coord_t coord);

// Returns `true` is the king of the moving side is currenly under check
bool isCheck(const Board &b);

inline bitboard_t cellAttackers(const Board &b, const coord_t coord, const Color c) {
return (c == Color::White) ? cellAttackers<Color::White>(b, coord)
: cellAttackers<Color::Black>(b, coord);
}

// Returns `true` is the king of the moving side is currenly under check
bool isCheck(const Board &b);

// Move generator
class MoveGen {
public:
// Creates a move generator for the board `b`. The provided board must not be changed from the
Expand All @@ -63,9 +64,9 @@ class MoveGen {
const Board &board() const { return b_; }

// All these functions generate all the legal moves plus some pseudo-legal moves. Thus, after
// applying some of the generated moves, the king may become under check, but are otherwise valid
// according to the rules of chess. The moves are written into `list`, and the return value
// indicates the number of moves generated.
// applying some of the generated moves, the king may become under check, but otherwise the moves
// are valid according to the rules of chess. The moves are written into `list`, and the return
// value indicates the number of moves generated.
//
// To generate only legal moves you can use `isMoveLegal()` function
size_t genAllMoves(Move *list) const;
Expand Down

0 comments on commit 5456822

Please sign in to comment.