31 lines
614 B
C++
31 lines
614 B
C++
#pragma once
|
|
#include <set>
|
|
#include "global.hpp"
|
|
|
|
using std::set;
|
|
|
|
// For deciding the best guess
|
|
struct Weighed_guess {
|
|
int weight;
|
|
vector<int> guess;
|
|
Weighed_guess(int _w, vector<int> _g) : weight(_w), guess(_g) {}
|
|
Weighed_guess() {}
|
|
};
|
|
|
|
// Solving the game
|
|
class Solver {
|
|
int N, M;
|
|
set<vector<int>> possible;
|
|
bool first_pick = true;
|
|
public:
|
|
Solver(int N, int M);
|
|
|
|
vector<int> guess();
|
|
void learn(vector<int> guess, Response response);
|
|
|
|
private:
|
|
void generate_set(vector<int> carry);
|
|
int get_weight(vector<int> guess);
|
|
Weighed_guess minimax(vector<int> carry);
|
|
Weighed_guess choose_possible();
|
|
};
|