-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunctions.h
More file actions
50 lines (41 loc) · 1.2 KB
/
functions.h
File metadata and controls
50 lines (41 loc) · 1.2 KB
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
// puzzle.h
#ifndef FUNCTIONS_H
#define FUNCTIONS_H
extern int unsolved;
extern int SIZE_ROWS;
extern int SIZE_COLUMNS;
typedef struct Sudoku {
struct Cell ***cells;
struct Square **squares;
} Sudoku;
typedef struct Square {
struct Cell **cells;
int numbers;
int possible[9];
int solvable;
struct Square *next;
} Square;
typedef struct Cell {
int number;
int possible[9]; /*9 numbers, either 0 or 1, indicating whether a certain number (9-1) can be put in that cell
0 = can be that number 1 = can't be that number
9 8 7 6 5 4 3 2 1
0 1 1 1 1 0 1 1 0 this sequence would mean that the number can be 9, 4 or 1*/
int solvable; //count of possible numbers that can be placed in a cell
Square *square;
int row;
int column;
} Cell;
Square **createSquares();
int updateSquares(Cell ***, int, int);
int squareSingles(Cell ***, Square **);
int checkRows(Cell ***, Square **);
int checkColumns(Cell ***, Square **);
int updateSolvable(Cell ***, int, int);
Sudoku *setUpPuzzle(int **);
Sudoku *createSudoku(Cell ***, Square **);
void solveCell(Cell *);
int checkPuzzle(Cell ***, Square **);
int **createPuzzle();
void printPuzzle(Cell ***);
#endif // FUNCTIONS_H