-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cpp
57 lines (55 loc) · 1.35 KB
/
Main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <algorithm>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <vector>
#define CLOAR 10
#define SIZE 4
#include "HBsolver.hpp"
// http://beechan.com/hit2.cgi
// https://www.gamesforthebrain.com/japanese/guesscolors/
using namespace std;
int main() {
HBsolver tri = HBsolver(SIZE, CLOAR, true);
int res = 99;
vector<int> attempt;
vector<pair<vector<int>, pair<int, int>>> list;
map<pair<int, int>, int> distri;
do
{
attempt = tri.suggest();
cout << "next shoud: ";
for (int i = 0; i < SIZE; i++) {
cout << attempt[i] << " ";
}
cout << "\n districution:" << endl;
;
distri = tri.find_distrubution(attempt);
for (auto itr = distri.begin(); itr != distri.end();itr++){
cout << "(" << itr->first.first << " " << itr->first.second << ") :" << itr->second << endl;
}
cout << "input: ";
for (int i = 0; i < SIZE; i++) {
cin >> attempt[i];
}
pair<int, int> result;
cout << "hit , blow: ";
cin >> result.first >> result.second;
list.push_back(make_pair(attempt,result));
cout << "submitted?[1/0]"<<endl;
int i;
cin >> i;
if(i==1){
res = tri.scan(attempt, result);
list.clear();
}
cout <<"possible pattern : "<< res << endl;
} while (res != 1);
attempt = tri.suggest();
cout << "next shoud: ";
for (int i = 0; i < SIZE; i++) {
cout << attempt[i] << " ";
}
cout << endl;
}