-
Notifications
You must be signed in to change notification settings - Fork 0
/
sudoku.cpp
30 lines (22 loc) · 843 Bytes
/
sudoku.cpp
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
#include "SudokuGrid.h"
#include <cstring>
int main(){
std::array<std::array<int, 9>, 9> gridStack = {
0, 0, 0, 0, 0, 1, 0, 9, 0,
0, 2, 4, 3, 6, 0, 0, 0, 0,
6, 1, 0, 0, 0, 0, 4, 0, 0,
8, 6, 0, 5, 9, 3, 7, 0, 4,
2, 7, 9, 6, 0, 4, 5, 0, 1,
0, 0, 3, 0, 0, 0, 9, 0, 8,
7, 0, 0, 9, 1, 0, 0, 4, 0,
0, 0, 2, 0, 0, 0, 6, 0, 0,
0, 0, 0, 8, 0, 6, 3, 7, 0
};
//Creating the above grid in the heap for encapsulation purposes
std::array<std::array<int, 9>, 9>* gridHeap = new std::array<std::array<int, 9>, 9>;
//Memcpy can be used since all the data in both arrays are contigous
memcpy(gridHeap, &gridStack[0][0], 81 * sizeof(int));
Grid grid(gridHeap);
grid.solve();
grid.print();
}