Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int count = 1, tempNumber, num;
- readSudokuFile(sudokuArray);
- while (count == 1)
- {
- bool found = false;
- while (!found)
- {
- num = ranNum(gen);
- if (sudokuArray[num] != 0)
- {
- found = true;
- tempNumber = sudokuArray[num];
- sudokuArray[num] = 0;
- }
- }
- NoConstraintList* m = new NoConstraintList;
- std::cout << "The contents of the space before search begins" << std::endl;
- m->print();
- // We initialise and get ready for search - search has not yet begun
- // DFS = depth first search
- DFS<NoConstraintList> searchengine(m);
- delete m;
- count = 0;
- // We loop through all solutions to the constraint problem
- while (NoConstraintList* s = searchengine.next()) {
- s->print(); delete s;
- count++;
- // all tuples (0..5, 0..5, 0..5) 216 of them
- }
- std::cout << "\nNumber of elements: " << count;
- }
- sudokuArray[num] = tempNumber;
- std::cout << "\n\nSudoku with only one solution: \n\n";
- for (int i = 0; i < SUDOKU; i++) {
- if (!(i % NUM)) {
- std::cout << '\n';
- }
- std::cout << sudokuArray[i] << " ";
- }
- std::cout << "\n\n";
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement