26 lines
600 B
C++
26 lines
600 B
C++
#pragma once
|
|
#include "global.hpp"
|
|
|
|
// 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;
|
|
vector<vector<int>> possible = vector<vector<int>>(0);
|
|
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<vector<int>> *possibilities, vector<int> *chosen, int index);
|
|
};
|