-
Notifications
You must be signed in to change notification settings - Fork 0
/
SudokuSolver.h
68 lines (57 loc) · 1.77 KB
/
SudokuSolver.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
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef SUDOKU_SOLVER_H
#define SUDOKU_SOLVER_H
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <queue>
#include "SudokuBase.h"
#include "Sudoku.h"
#include "Cell.h"
#include "Task.h"
using namespace std;
class SudokuSolver : public SudokuBase
{
private:
typedef u_short counter;
bool possible[Row][Col][NumberRange];
bool horGroupPossible[Row][Tower][NumberRange];
bool verGroupPossible[Col][Floor][NumberRange];
counter impossibility [Row][Col];
counter rowImpossibility[Row] [NumberRange];
counter colImpossibility [Col][NumberRange];
counter blockImpossibility[Floor][Tower][NumberRange];
counter horGroupImpossibility[Row][Tower][NumberRange];
counter verGroupImpossibility[Col][Floor][NumberRange];
counter floorGroup[Floor][Tower][NumberRange];
counter towerGroup[Tower][Floor][NumberRange];
counter rowGroup[Row][NumberRange];
counter colGroup[Col][NumberRange];
queue<Cell> qFill;
queue<Task> qCheck;
counter effectiveCell;
counter filledCell;
Status status;
void Copy(const SudokuSolver &);
void Reset();
void Maintain();
void Fill();
void CheckImpoCell(const Cell &);
void CheckImpoHorGroup(const Cell &);
void CheckImpoVerGroup(const Cell &);
void CheckKnownHorGroup(const Cell &);
void CheckKnownVerGroup(const Cell &);
void Test();
void FillNotChange(const Cell &);
Cell MinPossibilityCell();
public:
SudokuSolver();
SudokuSolver(const SudokuSolver &);
SudokuSolver & operator = (const SudokuSolver &);
~SudokuSolver(){}
void Solve(const SudokuBase &);
void Fill(const Cell &);
void GetAnAnswer();
Status GetStatus() const;
friend ostream & operator<(ostream &, const SudokuSolver &);
};
#endif