-extern bool move_is_legal(const Position& pos, const Move m, Bitboard pinned);
-extern bool move_is_legal(const Position& pos, const Move m);
+ explicit MoveList(const Position& pos) : last(generate<T>(pos, moveList)) {}
+ const ExtMove* begin() const { return moveList; }
+ const ExtMove* end() const { return last; }
+ size_t size() const { return last - moveList; }
+ bool contains(Move move) const {
+ for (const auto& m : *this) if (m == move) return true;
+ return false;
+ }
+
+private:
+ ExtMove moveList[MAX_MOVES], *last;
+};