#ifndef ORDLE_H #define ORDLE_H #include #include #include #include #include #include #include // Helper types and aliases using size_type = std::string::size_type; using letters_and_indices = std::map; // Function declarations std::vector read_candidates(std::istream &input); bool contains_any_of(const std::string &s, const std::string &cs); bool contains_at(const std::string &s, char c, size_type pos); bool contains_but_not_at(const std::string &s, char c, size_type pos); // Functors struct wrong_fn { explicit wrong_fn(const std::string &letters); bool operator()(const std::string &word) const; private: std::string l; }; struct correct_fn { explicit correct_fn(const letters_and_indices &idxs); bool operator()(const std::string &word) const; private: letters_and_indices m; }; struct misplaced_fn { explicit misplaced_fn(const letters_and_indices &idxs); bool operator()(const std::string &word) const; private: letters_and_indices m; }; void do_filter(std::vector &candidates, const std::string &wrong, const letters_and_indices &green, const letters_and_indices &yellow); letters_and_indices build_list(const std::string &line); std::tuple prompt(); #endif // ORDLE_H