summaryrefslogtreecommitdiff
path: root/solve.c
diff options
context:
space:
mode:
Diffstat (limited to 'solve.c')
-rw-r--r--solve.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/solve.c b/solve.c
index ff82351..7aae707 100644
--- a/solve.c
+++ b/solve.c
@@ -341,53 +341,3 @@ int board_is_solved(struct cell (*b)[9][9])
return ret;
}
-
-int main(int argc, char **argv)
-{
- struct cell board[9][9];
- FILE *f = NULL;
-
- memset(board, 0, sizeof(board));
-
- if (argc != 2) {
- printf("Syntax: %s puzzle_file\n", argv[0]);
- return 1;
- }
-
- f = fopen(argv[1], "r");
- if (!f) {
- perror("fopen");
- return 1;
- }
-
- if (load(f, &board) < 0) {
- fclose(f);
- return 1;
- }
-
- fclose(f);
-
- display(board);
-
- int i = 0;
- int total_changes = 0;
- int change_count = -1;
- /* 9*9 is worst case */
- for (i = 0; i < 9*9 && change_count; i++) {
- change_count = 0;
- update_not_row_col(&board);
- change_count += not_to_val_cell(&board);
- change_count += solve_row_col(&board);
- change_count += cells_fill_certainties(&board);
- total_changes += change_count;
-// display(board);
- }
-
- if (board_is_solved(&board) < 0) {
- printf("Could not solve the board! Here is the closest (%d changes)\n", total_changes);
- } else {
- printf("Solution (%d changes)\n", total_changes);
- }
- display(board);
-
-}