summaryrefslogtreecommitdiff
path: root/solve.h
blob: ea1d1ca2da9c15d8369635c1eda5eab5f4057323 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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 */