Minimax implemented without getting weight
This commit is contained in:
parent
cfbe716587
commit
16e1acc51d
2 changed files with 16 additions and 4 deletions
18
solver.cpp
18
solver.cpp
|
@ -34,7 +34,19 @@ void Solver::learn(vector<int> guess, Response response) {
|
|||
int Solver::get_weight(vector<int> guess) {
|
||||
return 0;
|
||||
}
|
||||
// TODO
|
||||
Weighed_guess Solver::minimax(vector<vector<int>> *possibilities, vector<int> *chosen, int index) {
|
||||
return {0, {}};
|
||||
Weighed_guess Solver::minimax(vector<int> carry) {
|
||||
if(carry.size() == N)
|
||||
return {get_weight(carry), carry};
|
||||
|
||||
Weighed_guess best = {-1, {}};
|
||||
for(int col = 0; col < M; col++) {
|
||||
carry.push_back(col);
|
||||
|
||||
Weighed_guess next = minimax(carry);
|
||||
if(next.weight > best.weight)
|
||||
best = next;
|
||||
|
||||
carry.pop_back();
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
|
|
@ -22,5 +22,5 @@ public:
|
|||
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);
|
||||
Weighed_guess minimax(vector<int> carry);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue