-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsudoku.h
44 lines (33 loc) · 937 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
#ifndef _SUDOKU_H_
#define _SUDOKU_H_
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
template <typename T = unsigned, unsigned N = 9>
class Sudoku
{
public:
Sudoku();
Sudoku(Sudoku const & s);
void read_from_file(std::string const & filename);
void write_to_file(std::string const & filename);
// <-- Solve interface: used by Backtrack algo
bool next();
bool first();
bool is_valid();
bool is_complete();
// --> Solve interface: used by Backtrack algo
template <typename U, unsigned M>
friend std::ostream & operator << (std::ostream & os, Sudoku<U, M> const & s);
private:
Sudoku & operator=(Sudoku const & s);
typedef T TGrid[N][N];
TGrid _Grid;
unsigned _BlockSize;
T* _CurrentDigit;
};
template <typename T, int N>
std::ostream & operator << (std::ostream & os, Sudoku<T, N> const & s);
#include "sudoku.hpp"
#endif