Skip to content

Commit

Permalink
add modifying legal_moves (#7)
Browse files Browse the repository at this point in the history
* add modifying `legal_moves`

* undo formatting error

* fix
  • Loading branch information
dave7895 authored Oct 3, 2022
1 parent d562a5f commit 7815391
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/legal_moves.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ namespace libchess {
return moves;
}

void Position::legal_moves(std::vector<Move> &moves) const noexcept {
legal_captures(moves);
legal_noncaptures(moves);
}

} // namespace libchess
2 changes: 2 additions & 0 deletions src/libchess/position.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ class Position {

[[nodiscard]] std::vector<Move> legal_noncaptures() const noexcept;

void legal_moves(std::vector<Move> &moves) const noexcept;

void legal_captures(std::vector<Move> &moves) const noexcept;

void legal_noncaptures(std::vector<Move> &moves) const noexcept;
Expand Down

0 comments on commit 7815391

Please sign in to comment.