-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsudoku.h
55 lines (34 loc) · 1.08 KB
/
sudoku.h
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
//
// Created by Dion on 25/10/2015.
//
#ifndef SUDOKU_SOLVER_SUDOKU_H
#define SUDOKU_SOLVER_SUDOKU_H
#define N 9 //must be a square number
#define R 3 //root of N
#include <iostream>
#include <functional>
#include <string.h>
class sudoku {
public:
int problem[N][N];
int solution[N][N];
bool candidates[N][N][N];
void printSolution(int*);
void printCandidates(int, int);
// void isCandidate(int, int, int);
void calcCandidate(int, int, int);
void initCandidates();
bool blockContains(int y, int k, int c); //y and x are the block coordinates, not the cell coordinates
bool rowContains(int, int);
bool columnContains(int, int);
bool isSolved();
void makeMove(std::string, int, int, int);
bool soleCandidate();
bool singleLocationInRow();
bool singleLocationInColumn();
bool singleLocationInBlock();
void solve(int (&problem)[N][N]);
};
bool convolve(sudoku*, std::function<bool(sudoku*, int y,int x)> call);
bool convolveBlock(sudoku*, std::function<bool(sudoku*, int y,int x)> call);
#endif //SUDOKU_SOLVER_SUDOKU_H