void Sudoku::change(){ srand(time(NULL)); int a,b,n; a = rand()%9+1; b = rand()%9+1; while(a == b || b == 0){ b=rand()%9+1; } changeNum(a,b); a = rand()%3; b = rand()%3; while(a == b){ b=rand()%3; } changeRow(a,b); a = rand()%3; b = rand()%3; while(a == b){ b=rand()%3; } changeCol(a,b); n = rand()%2; flip(n); n = rand()%101; rotate(n); }
void Sudoku::giveQuestion(){ int array[81] = { 5, 3, 0, 0, 7, 0, 0, 0, 0, 6, 0, 0, 1, 9, 5, 0, 0, 0, 0, 9, 8, 0, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 0, 0, 3, 4, 0, 0, 8, 0, 3, 0, 0, 1, 7, 0, 0, 0, 2, 0, 0, 0, 6, 0, 6, 0, 0, 0, 0, 2, 8, 0, 0, 0, 0, 4, 1, 9, 0, 0, 5, 0, 0, 0, 0, 8, 0, 0, 7, 9 }; Sudoku test(array); *this = test; srand(time(NULL)); changeNum(rand() % 9 + 1, rand() % 9 + 1); changeRow(rand() % 3, rand() % 3); changeCol(rand() % 3, rand() % 3); rotate(rand() % 101); flip(rand() % 2); printSudokuSolution(); /*for(int i = 0; i < 9; i++){ for(int j = 0; j < 9; j++) cout<<array[i * 9 + j]<<" "; cout<<endl; } */ }
void Sudoku::change(){ srand(time(NULL)); changeNum(rand()%sudokuNum+1, rand()%sudokuNum+1); changeRow(rand()%3, rand()%3); changeCol(rand()%3, rand()%3); rotate(rand()%101); flip(rand()%2); }
void Sudoku::change(){ srand(time(NULL)); for(int i=0; i<10; i++){ changeNum(rand()%9+1, rand()%9+1); changeRow(rand()%3, rand()%3); changeCol(rand()%3, rand()%3); rotate(rand()%4); flip(rand()%2); } }
int main() { int num; void changeNum(int num); printf("����һ����:\n"); scanf("%d",&num); changeNum( num); printf("\n"); return 0; }
void Sudoku::transform(){ srand(time(NULL)); changeNum(rand() % 9 + 1, rand() % 9 + 1); changeRow(rand() % 3, rand() % 3); changeCol(rand() % 3, rand() % 3); rotate(rand() % 101); flip(rand() % 2); printSudokuSolution(); }
void Connection :: DisconnectClicked() { emit changeNum(); DisconnectButton->setEnabled(false); ConnectButton->setEnabled(true); can0->setEnabled(true); OnOff->setText("OFF"); Controller::getController()->disconnect(Controller::getController()->contrNum); emit disactive(); }
void changeNum(int x) { if(x>1) { changeNum(x/2); printf("%d",x%2); } else printf("1"); }
int main() { int *px; int *py; alloc_int(&px); alloc_int(&py); *px = 100; *py = 200; changeNum(px, py); printf("%d %d\n", *px, *py); free(px); free(py); return 0; }
int trynum() { int zero,i,j,sum; int checki[4]; int countA=0, countB=0; num[numex[0]][numex[1]][numex[2]][numex[3]] = 0; for (i=0;i<10000;i++){ changeNum(i,checki); if(num[checki[0]][checki[1]][checki[2]][checki[3]] == 1) { for (j=0;j<4;j++) { numex[j] = checki[j]; } return 0; } } return 1; }
int checkNum() { int i,count1=0,now; int checki[4]; for (i=0;i<10000;i++){ changeNum(i,checki); if(checkStringInt(checki) == 0) { if(num[checki[0]][checki[1]][checki[2]][checki[3]] == 1) { count1++; now = i; } } } if (count1 == 1) { return now; } else if (count1 == 0) { return 1; } return 0; }
void checkHandB(int h, int b) { int i, blow, hit; int numi[4]; static int countHB = 0; for (i=0;i<10000;i++){ changeNum(i,numi); if(checkStringInt(numi) == 0) { blow = countBlowInt(numi); hit = countHitInt(numi); if (countHB == 0) { if (h==hit && b==blow) { num[numi[0]][numi[1]][numi[2]][numi[3]] = 1; } } else { if (h!=hit || b!=blow) { num[numi[0]][numi[1]][numi[2]][numi[3]] = 0; } } } } countHB++; }