logik/global.hpp
2024-12-26 21:19:57 +01:00

35 lines
897 B
C++

#pragma once
#include <iostream>
#include <vector>
#include <string>
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) {}
bool operator==(Response second) {
return somewhere == second.somewhere && correct == second.correct;
}
bool operator!=(Response second) {
return !(operator==(second));
}
};
// Game generating
string get_input(string arg, vector<string> args, string prompt_text, string default_arg);
vector<int> generate(int N, int M);
// Formatting
string format_response(Response response);
string format_guess(vector<int> guess);
string format_guess_history(vector<int> sequence, vector<int> guess);
string format_lost_sequence(vector<int> sequence);
// Validating
Response validate(vector<int> sequence, vector<int> guess);