summaryrefslogtreecommitdiff
path: root/solve.h
diff options
context:
space:
mode:
Diffstat (limited to 'solve.h')
-rw-r--r--solve.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/solve.h b/solve.h
new file mode 100644
index 0000000..ea1d1ca
--- /dev/null
+++ b/solve.h
@@ -0,0 +1,63 @@
+#ifndef SUDOKU_SOLVE_H
+#define SUDOKU_SOLVE_H
+
+#include "cell.h"
+
+/*
+ * For all unsolved cells on the board, solve them if they have been marked as
+ * impossible to be 8/9 values
+ */
+int solve_row_col(struct cell (*b)[9][9]);
+
+/*
+ * FIXME rename - cell != cell
+ * For all unsolved cells on the board, solve them if they are the only place
+ * left in their local 3x3 (box) that a value missing from that box could fit
+ */
+int not_to_val_cell(struct cell (*b)[9][9]);
+
+
+/* For the numbers 1-9 not filled into a cell, fill in those which have only
+ * one place they can go */
+int cell_fill_certainties(struct cell (*b)[9][9], int bx, int by);
+
+int cells_fill_certainties(struct cell (*b)[9][9]);
+
+/*
+ * Check if every cell on a board is filled.
+ * Returns -1 isf the board is not fully
+ * Returns 0 if the board is filled
+ */
+int board_is_filled(struct cell (*b)[9][9]);
+
+/*
+ * Check if all of the rows on are correctly solved on a board
+ * Returns 0 for all rows correctly solved
+ */
+int board_rows_are_solved(struct cell (*b)[9][9]);
+
+/*
+ * Check if all of the columns on are correctly solved on a board
+ * Returns 0 for all columns correctly solved
+ */
+int board_cols_are_solved(struct cell (*b)[9][9]);
+
+/*
+ * Check if one of the nine 3x3 boxes is correctly solved on a board
+ * Returns 0 for a correctly solved 3x3
+ */
+int board_box_is_solved(struct cell (*b)[9][9], int bx, int by);
+
+/*
+ * Check if all of the nine 3x3 boxes are correctly solved on a board
+ * Returns 0 for correctly solved boxes
+ */
+int board_boxes_are_solved(struct cell (*b)[9][9]);
+
+/*
+ * Check if a board is solved.
+ * Returns 0 if the board is solved correctly
+ */
+int board_is_solved(struct cell (*b)[9][9]);
+
+#endif /* SUDOKU_SOLVE_H */