-
Notifications
You must be signed in to change notification settings - Fork 1
/
sudoku.h
executable file
·50 lines (40 loc) · 983 Bytes
/
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
#ifndef SUDOKU_H
#define SUDOKU_H
#include <vector>
#include <set>
typedef std::set<int> Node;
typedef std::vector< Node > Grid;
typedef std::vector< Node* > Group;
class Sudoku
{
private:
Grid grid;
int N,S,R,C,SR,SC,NSH,NSV;
std::set<int> bad;
std::set<int> given;
int nsolutions;
private:
Group Row (int);
Group Column (int);
Group SubGrid (int);
private:
void GroupCheck (int,int);
void RandomCheck (bool count=false);
bool generateGrid_private (int, Node*, std::vector<int>);
void findBadNodes_private (int[]);
bool Solve_private (bool count=false);
public:
bool Solve ();
int nSolutions ();
void findBadNodes ();
bool failed ();
const Node& GetNode (int,int) const;
void generateGrid (int);
const std::set<int>& badNodes () const;
public:
Sudoku(int,int,int,int,int[]);
Sudoku(int,int,int,int);
private:
Sudoku(int,int,int,int,Grid);
};
#endif // SUDOKU_H