bool Control::opntFind8() { int n=myThree.size(); vector<int>::iterator iter=myThree.end()-1; if (*iter==12&&!findBomb()) return false; else if (*iter==12&&findBomb()) return true; findThree(); std::cout<<"p"; if (opntPos.size()>=3*n) { opntPos.assign(opntPos.begin(),opntPos.begin()+3*n); return true; } else if(findBomb()) { opntThree.clear(); return true; } else { opntPos.clear(); opntThree.clear(); return false; } }
int main(int argc, const char * argv[]) { // insert code here... printf("Hello, World!\n"); int a[] = {1,1,1,2,2,2,3,3,3,5,5,5,8,8,8,10,9,9,9}; int n = sizeof(a) / sizeof(a[0]); int result = findThree(a,n); return 0; }
bool Control::opntFind10() { int i,cnt=0,n=myThree.size(); vector<int> tmp(opntC.begin(),opntC.end()-1); vector<int>::iterator iter=myThree.end()-1,iter2; if (*iter==12&&!findBomb()) return false; else if (*iter==12&&findBomb()) return true; findThree(); iter2=opntThree.end()-1; if (opntPos.size()>=3*n) { for (i=0;i<opntPos.size();i++) tmp[opntPos[i]]=0; for (i=0,cnt=0;i<tmp.size()-1&&cnt<myThree.size();i++) if (tmp[i]&&(tmp[i]>*iter2||tmp[i]<opntThree[0])&&tmp[i]==tmp[i+1]) { opntPos.insert(opntPos.begin()+2*cnt+3*(cnt+1),i); cnt++; opntPos.insert(opntPos.begin()+4*cnt,i+1); i++; } if (cnt==n) return true; else if(findBomb()) { opntThree.clear(); return true; } else { opntPos.clear(); opntThree.clear(); return false; } } else if(findBomb()) { opntThree.clear(); return true; } else { opntPos.clear(); opntThree.clear(); return false; } }