本文整理汇总了C++中AI::complete_puzzle方法的典型用法代码示例。如果您正苦于以下问题:C++ AI::complete_puzzle方法的具体用法?C++ AI::complete_puzzle怎么用?C++ AI::complete_puzzle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AI
的用法示例。
在下文中一共展示了AI::complete_puzzle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
Sodoku = Grid(start_3);
break;
}
else if (nm == 4) {
Sodoku = Grid(win_test);
break;
}
else if (nm == 5) {
Sodoku = Grid();
break;
}
else {
printf("Incorrect input\n");
}
}
for (;;) {
Sodoku.display_grid();
while (1) {
//break;
printf("Select an option\n");
printf("1: Enter a number ");
printf("2: Check for a win\n");
printf("3: Display board again ");
printf("4: How to play\n");
nm = NULL;
scanf("%d", &nm);
if (nm == 1)break;
else if (nm == 2) {
//Check for win
finished = checker.complete_puzzle(Sodoku);
if (finished) {
break;
}
else {
printf("Game is not complete\n");
}
}
else if (nm == 3) {
Sodoku.display_grid();
}
else if (nm == 4) {
//Display rules
show_rules();
}
else {
printf("Not an option\n");
}
}
if (finished) {
break;
}
while (1) {
printf("Choose a row: ");
rw = NULL;
scanf("%d", &rw);
printf("Choose a column: ");
cl = NULL;
scanf("%d", &cl);
if (rw < 1 || rw > 9 || cl < 1 || cl > 9) {
printf("Not a square, pick again\n");
}
else if (Sodoku.is_unlocked(rw-1, cl-1)) {
printf("Square is locked, pick again\n");
}
else {
printf("Choosen square: %d,%d\n", rw, cl);
break;
}
}
while (1) {
printf("Choose a new number between 1-9: ");
nm = NULL;
scanf("%d", &nm);
if (nm < 0 || nm > 9) {
printf("Incorrect input");
}
else {
break;
}
}
Sodoku.update_cell(rw-1, cl-1, nm);
if (checker.constrant_check(Sodoku, Sodoku.get_cell(rw - 1, cl - 1))) {
printf("Good\n");
}
}
Sodoku.display_grid();
printf("You have won Sodoku!!!");
return 0;
}