#include <iostream>
#include <vector>
using std::cout;
using std::cin;
using std::vector;
vector<int> v;
int right, position, count=0;
int main()
{
cout << "Now guess your number in mind is # # # #. ";
for(int i =1; i <=9; ++i)
{
cout << "I guess: " << i << " " << i << " " << i << " " << i << "\n";
count++;
cin >> right;// >> position;
if(right > 0)
{
for(int idx=0; idx<right;++idx)
{
v.push_back(i);
}
}
if(v.size() == 4)
break;
}
cout << "now 4 digits is :" << v[0] << "," << v[1] << "," << v[2] << "," << v[3] << ".\n";
for(int i=0; i < 4; ++i)
{
for(int j=0; j < 4; ++j)
{
if(j==i)
{
continue;
}
for(int k=0; k <4; ++k )
{
if(k==i || k==j)
{
continue;
}
for(int l=0; l < 4; ++l)
{
if(l==i || l==j || l==k)
{
continue;
}
cout << "I guess: " << v[i] << " " << v[j] << " " << v[k] << " " << v[l] << "\n";
count++;
cin >> position;/*right >>*/
if(position == 4)
{
cout << "Totally " << count << " pass!";
system("PAUSE");
return 0;
}
}
}
}
}
}