#pragma once #include #include #include #include using std::vector; using std::string; using std::cout; using std::cin; // Generic type struct Response { int somewhere, correct; Response() {} Response(int _s, int _c) : somewhere(_s), correct(_c) {} }; // Game generating string get_input(string arg, vector args, string prompt_text, string default_arg); vector generate(int N, int M); // Formatting string format_response(Response response); string format_guess(vector guess); string format_guess_history(vector sequence, vector guess); string format_lost_sequence(vector sequence); // Validating Response validate(vector sequence, vector guess); // Game remembering struct Game { private: vector> possible; vector empty_colors; vector final; std::default_random_engine random_engine; public: int N, M; Game(int _N, int _M); // Get known information bool can(int n, int col); int final_color(int n); bool is_empty(int col); void print(); vector> list_all_possibilities(); vector> get_positions_of_colors(vector guess); // Utility functions void cannot_be(int n, int col); void must_be(int n, int must_col); void empty_color(int col); // Learning functions bool if_not_here_then_nowhere(vector guess); void here(vector guess); void not_here(vector guess); void empty(vector guess); void all_are_here(vector guess); }; // Guess-response remembering struct Historic_guess { vector guess; Response response; Historic_guess(vector _guess, Response _response); };