-
Notifications
You must be signed in to change notification settings - Fork 0
/
collection.c
81 lines (77 loc) · 1.96 KB
/
collection.c
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
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* Sudoku E-solver - simple sudoku solver
*
* Copyright (c) 2015 Sasha Khapyorsky <sashakh@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include "sudoku.h"
s_type s_collection[][D * D] = {
{},
{
6, 0, 0, 1, 0, 0, 0, 7, 0,
4, 0, 1, 9, 0, 0, 0, 0, 0,
9, 0, 2, 8, 0, 0, 0, 0, 0,
0, 6, 0, 0, 0, 0, 0, 0, 9,
0, 1, 5, 0, 0, 0, 4, 6, 0,
7, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 2, 8, 0, 6,
0, 0, 0, 0, 0, 8, 5, 0, 3,
0, 9, 0, 0, 0, 4, 0, 0, 7,
},
{
0, 0, 0, 0, 1, 7, 0, 3, 0,
0, 1, 0, 0, 0, 5, 0, 8, 2,
0, 0, 0, 4, 0, 0, 0, 0, 0,
0, 0, 7, 0, 0, 0, 0, 6, 3,
8, 0, 9, 0, 0, 0, 4, 0, 1,
6, 2, 0, 0, 0, 0, 5, 0, 0,
0, 0, 0, 0, 0, 8, 0, 0, 0,
2, 3, 0, 7, 0, 0, 0, 1, 0,
0, 7, 0, 1, 6, 0, 0, 0, 0,
},
{
0, 1, 6, 2, 3, 0, 0, 0, 0,
2, 0, 0, 0, 0, 4, 0, 0, 8,
0, 7, 0, 0, 0, 0, 0, 2, 0,
0, 3, 0, 0, 6, 0, 9, 0, 0,
0, 0, 1, 0, 0, 0, 6, 0, 0,
0, 0, 9, 0, 1, 0, 0, 4, 0,
0, 4, 0, 0, 0, 0, 0, 7, 0,
5, 0, 0, 4, 0, 0, 0, 0, 3,
0, 0, 0, 0, 7, 5, 1, 8, 0,
},
{
2, 0, 1, 8, 0, 0, 0, 0, 0,
6, 0, 0, 0, 7, 0, 0, 0, 0,
0, 4, 3, 0, 0, 0, 2, 0, 0,
0, 0, 5, 0, 3, 0, 0, 2, 9,
0, 0, 0, 1, 0, 2, 0, 0, 0,
8, 2, 0, 0, 6, 0, 1, 0, 0,
0, 0, 6, 0, 0, 0, 5, 8, 0,
0, 0, 0, 0, 4, 0, 0, 0, 1,
0, 0, 0, 0, 0, 8, 9, 0, 4,
},
{
4, 0, 0, 2, 0, 0, 8, 9, 7,
0, 0, 0, 0, 0, 0, 2, 0, 1,
7, 0, 0, 0, 1, 3, 0, 0, 0,
8, 0, 7, 0, 0, 9, 0, 6, 3,
0, 6, 0, 1, 4, 8, 0, 5, 0,
5, 2, 0, 6, 0, 0, 1, 0, 9,
0, 0, 0, 7, 9, 0, 0, 0, 8,
1, 0, 5, 0, 0, 0, 0, 0, 0,
2, 7, 9, 0, 0, 5, 0, 0, 6,
},
};
unsigned sudoku_collection_size()
{
return sizeof(s_collection) / sizeof(s_collection[0]);
}
s_type *sudoku_collection_get(unsigned num)
{
return num < sudoku_collection_size() ? s_collection[num] : s_collection[0];
}