本文整理汇总了C++中Sudoku::isSolved方法的典型用法代码示例。如果您正苦于以下问题:C++ Sudoku::isSolved方法的具体用法?C++ Sudoku::isSolved怎么用?C++ Sudoku::isSolved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sudoku
的用法示例。
在下文中一共展示了Sudoku::isSolved方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solve
Sudoku* solve (Sudoku* puzzle) {
Sudoku* track;
// puzzle->finalize();
puzzle->horSolve();
puzzle->verSolve();
puzzle->boxSolve();
int result = puzzle->finalize();
// cout << "fault?" << endl; // test
// cout << result << endl; // test
if (result == -1) {
// cout << "" << endl;
// cerr << "ERROR" << endl;
return NULL;
}
else if (puzzle->isSolved() == 1) {
// cout << "111111111"<< endl;
// cout << "111address :" << puzzle << endl;
return puzzle;
}
else if (result == 0) {
// cout << "runhere?" << endl; // run here test
// Sudoku* newpuzzle = puzzle->guess();
Sudoku * newpuzzle = puzzle->guess();
// cout << "run here? newpuzzle" << endl; // test
// cout << *newpuzzle << endl; // test newpuzzle;
track = solve(newpuzzle);
//cout << newpuzzle<< endl;
// solve (newpuzzle); // re
if (track == NULL) {
// cout << "track" << endl; // test
// cout << *track << endl; // test
//delete track;
// cout << "wronguess and solve the orginal puzzle" << endl;
// cout << *puzzle << endl;
return solve(puzzle);
}
else if (track->isSolved()) {
// cout << "444address: " << track << endl;
return track;
}
else {
// cout << "333address: " << newpuzzle << endl;
return solve (newpuzzle);
}
// cout << "33333333" <<endl;
// cout << "333address: " << newpuzzle << endl;
// return newpuzzle;
//cout << "caonima" << endl;
}
else {
// cout << "4444444444" << endl;
return solve(puzzle); //re
}
}