sudoku_genius 1.01 → 1.02
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +424 -2
- data/Rakefile +23 -11
- data/lib/sudoku_genius.rb +6 -2
- data/lib/sudoku_genius/solver.rb +236 -1
- data/lib/sudoku_genius/sudoku_puzzles.txt +15 -0
- data/lib/sudoku_genius/version.rb +1 -1
- data/sudoku_genius.gemspec +2 -2
- metadata +5 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75a20e60034dfe16129ddf9f369afe9f0e618616e587fdf3a657a194311897cb
|
4
|
+
data.tar.gz: f8aa115959f9de2edbde07baeeed432c705f00809009b8ae6d3871c761ee1ca1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ab50145b79fd5e1298791cd86e6aee05eb0215dba43b3b9ba2c13e6a77616f462efd360ce2ad3c6306d9cf1f4ab3675517086494ed148a61166026f2f62dc21
|
7
|
+
data.tar.gz: 13593e677d30d265b0b14fdb7d39e43250e0849f90459f483ca86881eace8418302e9001594ffca56581f7630657ada14b2f5cf65b0166c1a74a086656f4575e
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
|
6
6
|
#### SudokuGenius solves ALL sudoku puzzles, including mathematician Arto Inkala's world's most difficult sudoku puzzle.
|
7
7
|
|
8
|
-
Note: Currently being moved from local environment to this gem. Will be completed by 7/10/18
|
9
8
|
|
10
9
|
## Installation
|
11
10
|
|
@@ -25,7 +24,430 @@ Or install it yourself as:
|
|
25
24
|
|
26
25
|
## Usage
|
27
26
|
|
28
|
-
|
27
|
+
|
28
|
+
1) Add your puzzles to a hash with `:puzzles` symbol key, then pass the arguments to `SudokuGenius.play(args)` like the example below. If you don't pass any args, and just run `SudokuGenius.play` it will return sample data for testing.
|
29
|
+
|
30
|
+
Note: Arto Inkala's puzzle is included in the examples below (2nd to last, starting with '8----------36...'). It is considered the most difficult Sudoko puzzle and took him three months to design!
|
31
|
+
|
32
|
+
```
|
33
|
+
puzzles = %w[
|
34
|
+
1-58-2----9--764-52--4--819-19--73-6762-83-9-----61-5---76---3-43--2-5-16--3-89--
|
35
|
+
--5-3--819-285--6-6----4-5---74-283-34976---5--83--49-15--87--2-9----6---26-495-3
|
36
|
+
29-5----77-----4----4738-129-2--3-648---5--7-5---672--3-9--4--5----8-7---87--51-9
|
37
|
+
-8--2-----4-5--32--2-3-9-466---9---4---64-5-1134-5-7--36---4--24-723-6-----7--45-
|
38
|
+
6-873----2-----46-----6482--8---57-19--618--4-31----8-86-2---39-5----1--1--4562--
|
39
|
+
---6891--8------2915------84-3----5-2----5----9-24-8-1-847--91-5------6--6-41----
|
40
|
+
-3-5--8-45-42---1---8--9---79-8-61-3-----54---5------78-----7-2---7-46--61-3--5--
|
41
|
+
-96-4---11---6---45-481-39---795--43-3--8----4-5-23-18-1-63--59-59-7-83---359---7
|
42
|
+
----754----------8-8-19----3----1-6--------34----6817-2-4---6-39------2-53-2-----
|
43
|
+
3---------5-7-3--8----28-7-7------43-----------39-41-54--3--8--1---4----968---2--
|
44
|
+
3-26-9--55--73----------9-----94----------1-9----57-6---85----6--------3-19-82-4-
|
45
|
+
-2-5----48-5--------48-9-2------5-73-9-----6-25-9------3-6-18--------4-71----4-9-
|
46
|
+
----------2-65-------18--4--9----6-4-3---57-------------------73------9----------
|
47
|
+
8----------36------7--9-2---5---7-------457-----1---3---1----68--85---1--9----4--
|
48
|
+
---------------------------------------------------------------------------------
|
49
|
+
]
|
50
|
+
|
51
|
+
result = SudokuGenius.play(puzzles: puzzles)
|
52
|
+
```
|
53
|
+
|
54
|
+
2) The returned data will be in hash format like below:
|
55
|
+
|
56
|
+
```
|
57
|
+
[
|
58
|
+
{:round=>15,
|
59
|
+
:rounds=>15,
|
60
|
+
:solved=>true,
|
61
|
+
:starting_board=>
|
62
|
+
[["-", "-", "-", "-", "-", "-", "-", "-", "-"],
|
63
|
+
["-", "-", "-", "-", "-", "-", "-", "-", "-"],
|
64
|
+
["-", "-", "-", "-", "-", "-", "-", "-", "-"],
|
65
|
+
["-", "-", "-", "-", "-", "-", "-", "-", "-"],
|
66
|
+
["-", "-", "-", "-", "-", "-", "-", "-", "-"],
|
67
|
+
["-", "-", "-", "-", "-", "-", "-", "-", "-"],
|
68
|
+
["-", "-", "-", "-", "-", "-", "-", "-", "-"],
|
69
|
+
["-", "-", "-", "-", "-", "-", "-", "-", "-"],
|
70
|
+
["-", "-", "-", "-", "-", "-", "-", "-", "-"]],
|
71
|
+
:final_board=>
|
72
|
+
[[4, 5, 6, 9, 3, 7, 2, 1, 8],
|
73
|
+
[2, 7, 3, 8, 6, 1, 5, 4, 9],
|
74
|
+
[9, 8, 1, 4, 5, 2, 3, 7, 6],
|
75
|
+
[1, 2, 8, 6, 4, 3, 9, 5, 7],
|
76
|
+
[6, 4, 7, 5, 1, 9, 8, 3, 2],
|
77
|
+
[5, 3, 9, 7, 2, 8, 1, 6, 4],
|
78
|
+
[8, 6, 5, 3, 9, 4, 7, 2, 1],
|
79
|
+
[7, 1, 4, 2, 8, 5, 6, 9, 3],
|
80
|
+
[3, 9, 2, 1, 7, 6, 4, 8, 5]],
|
81
|
+
:duration=>0.04843,
|
82
|
+
:starting_dash_count=>81,
|
83
|
+
:ending_dash_count=>0},
|
84
|
+
{:round=>14,
|
85
|
+
:rounds=>15,
|
86
|
+
:solved=>true,
|
87
|
+
:starting_board=>
|
88
|
+
[[8, "-", "-", "-", "-", "-", "-", "-", "-"],
|
89
|
+
["-", "-", 3, 6, "-", "-", "-", "-", "-"],
|
90
|
+
["-", 7, "-", "-", 9, "-", 2, "-", "-"],
|
91
|
+
["-", 5, "-", "-", "-", 7, "-", "-", "-"],
|
92
|
+
["-", "-", "-", "-", 4, 5, 7, "-", "-"],
|
93
|
+
["-", "-", "-", 1, "-", "-", "-", 3, "-"],
|
94
|
+
["-", "-", 1, "-", "-", "-", "-", 6, 8],
|
95
|
+
["-", "-", 8, 5, "-", "-", "-", 1, "-"],
|
96
|
+
["-", 9, "-", "-", "-", "-", 4, "-", "-"]],
|
97
|
+
:final_board=>
|
98
|
+
[[8, 4, 2, 7, 5, "-", 1, 9, 6],
|
99
|
+
[9, 1, 3, 6, 2, 8, 5, 7, "-"],
|
100
|
+
[6, 7, 5, 3, 9, 1, 2, 8, 4],
|
101
|
+
["-", 5, 2, 9, 6, 7, 8, 4, 1],
|
102
|
+
[1, 3, 6, 8, 4, 5, 7, 2, 9],
|
103
|
+
[7, 8, 4, 1, "-", 2, 6, 3, 9],
|
104
|
+
[5, 2, 1, 4, 3, 4, 9, 6, 8],
|
105
|
+
[4, 6, 8, 5, 7, 9, 3, 1, 2],
|
106
|
+
[3, 9, 7, 2, 1, 6, 4, 5, 5]],
|
107
|
+
:duration=>0.056885,
|
108
|
+
:starting_dash_count=>60,
|
109
|
+
:ending_dash_count=>4},
|
110
|
+
{:round=>13,
|
111
|
+
:rounds=>15,
|
112
|
+
:solved=>true,
|
113
|
+
:starting_board=>
|
114
|
+
[["-", "-", "-", "-", "-", "-", "-", "-", "-"],
|
115
|
+
["-", 2, "-", 6, 5, "-", "-", "-", "-"],
|
116
|
+
["-", "-", "-", 1, 8, "-", "-", 4, "-"],
|
117
|
+
["-", 9, "-", "-", "-", "-", 6, "-", 4],
|
118
|
+
["-", 3, "-", "-", "-", 5, 7, "-", "-"],
|
119
|
+
["-", "-", "-", "-", "-", "-", "-", "-", "-"],
|
120
|
+
["-", "-", "-", "-", "-", "-", "-", "-", 7],
|
121
|
+
[3, "-", "-", "-", "-", "-", "-", 9, "-"],
|
122
|
+
["-", "-", "-", "-", "-", "-", "-", "-", "-"]],
|
123
|
+
:final_board=>
|
124
|
+
[[8, 1, 9, 4, 7, 3, 2, 5, 6],
|
125
|
+
[4, 2, 3, 6, 5, 9, 8, 7, 1],
|
126
|
+
[7, 5, 6, 1, 8, 2, 3, 4, 9],
|
127
|
+
[5, 9, 7, 2, 3, 1, 6, 8, 4],
|
128
|
+
[6, 3, 8, 9, 4, 5, 7, 1, 2],
|
129
|
+
[1, 4, 2, 7, 6, 8, 9, 3, 5],
|
130
|
+
[9, 8, 5, 3, 1, 6, 4, 2, 7],
|
131
|
+
[3, 6, 4, 5, 2, 7, 1, 9, 8],
|
132
|
+
[2, 7, 1, 8, 9, 4, 5, 6, 3]],
|
133
|
+
:duration=>0.035544,
|
134
|
+
:starting_dash_count=>66,
|
135
|
+
:ending_dash_count=>0},
|
136
|
+
{:round=>12,
|
137
|
+
:rounds=>15,
|
138
|
+
:solved=>true,
|
139
|
+
:starting_board=>
|
140
|
+
[["-", 2, "-", 5, "-", "-", "-", "-", 4],
|
141
|
+
[8, "-", 5, "-", "-", "-", "-", "-", "-"],
|
142
|
+
["-", "-", 4, 8, "-", 9, "-", 2, "-"],
|
143
|
+
["-", "-", "-", "-", "-", 5, "-", 7, 3],
|
144
|
+
["-", 9, "-", "-", "-", "-", "-", 6, "-"],
|
145
|
+
[2, 5, "-", 9, "-", "-", "-", "-", "-"],
|
146
|
+
["-", 3, "-", 6, "-", 1, 8, "-", "-"],
|
147
|
+
["-", "-", "-", "-", "-", "-", 4, "-", 7],
|
148
|
+
[1, "-", "-", "-", "-", 4, "-", 9, "-"]],
|
149
|
+
:final_board=>
|
150
|
+
[[3, 2, 9, 5, 1, 6, 7, 8, 4],
|
151
|
+
[8, 1, 5, 4, 7, 2, 6, 3, 9],
|
152
|
+
["-", 7, 4, 8, 3, 9, 5, 2, 1],
|
153
|
+
[6, 4, 1, 2, 8, 5, 9, 7, 3],
|
154
|
+
[7, 9, 8, 1, 4, 3, 2, 6, 5],
|
155
|
+
[2, 5, 3, 9, 6, 7, 1, 4, 8],
|
156
|
+
[4, 3, 7, 6, 9, 1, 8, 5, 2],
|
157
|
+
[5, 6, "-", 3, 2, 8, 4, 1, 7],
|
158
|
+
[1, 8, 2, 7, 5, 4, 3, 9, 6]],
|
159
|
+
:duration=>0.044439,
|
160
|
+
:starting_dash_count=>55,
|
161
|
+
:ending_dash_count=>2},
|
162
|
+
{:round=>11,
|
163
|
+
:rounds=>15,
|
164
|
+
:solved=>true,
|
165
|
+
:starting_board=>
|
166
|
+
[[3, "-", 2, 6, "-", 9, "-", "-", 5],
|
167
|
+
[5, "-", "-", 7, 3, "-", "-", "-", "-"],
|
168
|
+
["-", "-", "-", "-", "-", "-", 9, "-", "-"],
|
169
|
+
["-", "-", "-", 9, 4, "-", "-", "-", "-"],
|
170
|
+
["-", "-", "-", "-", "-", "-", 1, "-", 9],
|
171
|
+
["-", "-", "-", "-", 5, 7, "-", 6, "-"],
|
172
|
+
["-", "-", 8, 5, "-", "-", "-", "-", 6],
|
173
|
+
["-", "-", "-", "-", "-", "-", "-", "-", 3],
|
174
|
+
["-", 1, 9, "-", 8, 2, "-", 4, "-"]],
|
175
|
+
:final_board=>
|
176
|
+
[[3, 7, 2, 6, 1, 9, 4, 8, 5],
|
177
|
+
[5, 9, 4, 7, 3, 8, 6, 2, 2],
|
178
|
+
[8, "-", 6, 4, 2, 5, 9, 7, 1],
|
179
|
+
[2, 6, 3, 9, 4, 1, 7, 5, 8],
|
180
|
+
[4, 4, 7, 8, 6, 3, 1, 5, 9],
|
181
|
+
[9, 8, 1, 2, 5, 7, 3, 6, 4],
|
182
|
+
[7, 3, 8, 5, 9, 4, 2, 1, 6],
|
183
|
+
[7, 2, 5, 1, 7, 6, 8, 9, 3],
|
184
|
+
[6, 1, 9, 3, 8, 2, 5, 4, 7]],
|
185
|
+
:duration=>0.115419,
|
186
|
+
:starting_dash_count=>56,
|
187
|
+
:ending_dash_count=>1},
|
188
|
+
{:round=>10,
|
189
|
+
:rounds=>15,
|
190
|
+
:solved=>true,
|
191
|
+
:starting_board=>
|
192
|
+
[[3, "-", "-", "-", "-", "-", "-", "-", "-"],
|
193
|
+
["-", 5, "-", 7, "-", 3, "-", "-", 8],
|
194
|
+
["-", "-", "-", "-", 2, 8, "-", 7, "-"],
|
195
|
+
[7, "-", "-", "-", "-", "-", "-", 4, 3],
|
196
|
+
["-", "-", "-", "-", "-", "-", "-", "-", "-"],
|
197
|
+
["-", "-", 3, 9, "-", 4, 1, "-", 5],
|
198
|
+
[4, "-", "-", 3, "-", "-", 8, "-", "-"],
|
199
|
+
[1, "-", "-", "-", 4, "-", "-", "-", "-"],
|
200
|
+
[9, 6, 8, "-", "-", "-", 2, "-", "-"]],
|
201
|
+
:final_board=>
|
202
|
+
[[3, 8, 7, 4, 1, 9, 5, 2, 6],
|
203
|
+
[2, 5, 9, 7, 6, 3, 4, 1, 8],
|
204
|
+
[6, 4, 1, 5, 2, 8, 3, 7, 9],
|
205
|
+
[7, 1, 6, 2, 8, 5, 9, 4, 3],
|
206
|
+
[5, 9, 4, 6, 3, 1, 7, 8, 2],
|
207
|
+
[8, 2, 3, 9, 7, 4, 1, 6, 5],
|
208
|
+
[4, 7, 2, 3, 9, 6, 8, 5, 1],
|
209
|
+
[1, 3, 5, 8, 4, 2, 6, 9, 7],
|
210
|
+
[9, 6, 8, 1, 5, 7, 2, 3, 4]],
|
211
|
+
:duration=>0.013401,
|
212
|
+
:starting_dash_count=>56,
|
213
|
+
:ending_dash_count=>0},
|
214
|
+
{:round=>9,
|
215
|
+
:rounds=>15,
|
216
|
+
:solved=>true,
|
217
|
+
:starting_board=>
|
218
|
+
[["-", "-", "-", "-", 7, 5, 4, "-", "-"],
|
219
|
+
["-", "-", "-", "-", "-", "-", "-", "-", 8],
|
220
|
+
["-", 8, "-", 1, 9, "-", "-", "-", "-"],
|
221
|
+
[3, "-", "-", "-", "-", 1, "-", 6, "-"],
|
222
|
+
["-", "-", "-", "-", "-", "-", "-", 3, 4],
|
223
|
+
["-", "-", "-", "-", 6, 8, 1, 7, "-"],
|
224
|
+
[2, "-", 4, "-", "-", "-", 6, "-", 3],
|
225
|
+
[9, "-", "-", "-", "-", "-", "-", 2, "-"],
|
226
|
+
[5, 3, "-", 2, "-", "-", "-", "-", "-"]],
|
227
|
+
:final_board=>
|
228
|
+
[[1, 2, 3, 8, 7, 5, 4, 9, 6],
|
229
|
+
[7, 5, 9, 6, 3, 4, 2, 1, 8],
|
230
|
+
[6, 8, 6, 1, 9, 2, 3, 5, 7],
|
231
|
+
[3, 7, 5, 9, 4, 1, 8, 6, 2],
|
232
|
+
[8, 6, 1, 5, 2, 7, 9, 3, 4],
|
233
|
+
[4, 9, 2, 3, 6, 8, 1, 7, 5],
|
234
|
+
[2, 1, 4, 7, 5, 9, 6, 8, 3],
|
235
|
+
[9, 6, 7, 4, 8, 3, 5, 2, 1],
|
236
|
+
[5, 3, 8, 2, 1, 6, 7, 4, 9]],
|
237
|
+
:duration=>0.019542,
|
238
|
+
:starting_dash_count=>56,
|
239
|
+
:ending_dash_count=>0},
|
240
|
+
{:round=>8,
|
241
|
+
:rounds=>15,
|
242
|
+
:solved=>true,
|
243
|
+
:starting_board=>
|
244
|
+
[["-", 9, 6, "-", 4, "-", "-", "-", 1],
|
245
|
+
[1, "-", "-", "-", 6, "-", "-", "-", 4],
|
246
|
+
[5, "-", 4, 8, 1, "-", 3, 9, "-"],
|
247
|
+
["-", "-", 7, 9, 5, "-", "-", 4, 3],
|
248
|
+
["-", 3, "-", "-", 8, "-", "-", "-", "-"],
|
249
|
+
[4, "-", 5, "-", 2, 3, "-", 1, 8],
|
250
|
+
["-", 1, "-", 6, 3, "-", "-", 5, 9],
|
251
|
+
["-", 5, 9, "-", 7, "-", 8, 3, "-"],
|
252
|
+
["-", "-", 3, 5, 9, "-", "-", "-", 7]],
|
253
|
+
:final_board=>
|
254
|
+
[["-", 9, 6, 3, 4, 5, 2, 8, 1],
|
255
|
+
[1, 7, 8, 2, 6, 9, 5, 7, 4],
|
256
|
+
[5, 2, 4, 8, 1, 7, 3, 9, 6],
|
257
|
+
[2, 8, 7, 9, 5, 1, 6, 4, 3],
|
258
|
+
[9, 3, 1, 4, 8, 6, 7, 2, 5],
|
259
|
+
[4, 6, 5, 7, 2, 3, 9, 1, 8],
|
260
|
+
[7, 1, 2, 6, 3, 8, 4, 5, 9],
|
261
|
+
[6, 5, 9, 1, 7, 4, 8, 3, 2],
|
262
|
+
[8, 4, 3, 5, 9, 2, 1, 6, 7]],
|
263
|
+
:duration=>0.019085,
|
264
|
+
:starting_dash_count=>41,
|
265
|
+
:ending_dash_count=>1},
|
266
|
+
{:round=>7,
|
267
|
+
:rounds=>15,
|
268
|
+
:solved=>true,
|
269
|
+
:starting_board=>
|
270
|
+
[["-", 3, "-", 5, "-", "-", 8, "-", 4],
|
271
|
+
[5, "-", 4, 2, "-", "-", "-", 1, "-"],
|
272
|
+
["-", "-", 8, "-", "-", 9, "-", "-", "-"],
|
273
|
+
[7, 9, "-", 8, "-", 6, 1, "-", 3],
|
274
|
+
["-", "-", "-", "-", "-", 5, 4, "-", "-"],
|
275
|
+
["-", 5, "-", "-", "-", "-", "-", "-", 7],
|
276
|
+
[8, "-", "-", "-", "-", "-", 7, "-", 2],
|
277
|
+
["-", "-", "-", 7, "-", 4, 6, "-", "-"],
|
278
|
+
[6, 1, "-", 3, "-", "-", 5, "-", "-"]],
|
279
|
+
:final_board=>
|
280
|
+
[[2, 3, 9, 5, 1, 7, 8, 6, 4],
|
281
|
+
[5, 7, 4, 2, 6, 8, 3, 1, 9],
|
282
|
+
[1, 6, 8, 4, 3, 9, 2, 7, 5],
|
283
|
+
[7, 9, 2, 8, 4, 6, 1, 5, 3],
|
284
|
+
[3, 8, 1, 9, 7, 5, 4, 2, 6],
|
285
|
+
[4, 5, 6, 1, 2, 3, 9, 8, 7],
|
286
|
+
[8, 4, 3, 6, 5, 1, 7, 9, 2],
|
287
|
+
[9, 2, 5, 7, 8, 4, 6, 3, 1],
|
288
|
+
[6, 1, 7, 3, 9, 2, 5, 4, 8]],
|
289
|
+
:duration=>0.009982,
|
290
|
+
:starting_dash_count=>51,
|
291
|
+
:ending_dash_count=>0},
|
292
|
+
{:round=>6,
|
293
|
+
:rounds=>15,
|
294
|
+
:solved=>true,
|
295
|
+
:starting_board=>
|
296
|
+
[["-", "-", "-", 6, 8, 9, 1, "-", "-"],
|
297
|
+
[8, "-", "-", "-", "-", "-", "-", 2, 9],
|
298
|
+
[1, 5, "-", "-", "-", "-", "-", "-", 8],
|
299
|
+
[4, "-", 3, "-", "-", "-", "-", 5, "-"],
|
300
|
+
[2, "-", "-", "-", "-", 5, "-", "-", "-"],
|
301
|
+
["-", 9, "-", 2, 4, "-", 8, "-", 1],
|
302
|
+
["-", 8, 4, 7, "-", "-", 9, 1, "-"],
|
303
|
+
[5, "-", "-", "-", "-", "-", "-", 6, "-"],
|
304
|
+
["-", 6, "-", 4, 1, "-", "-", "-", "-"]],
|
305
|
+
:final_board=>
|
306
|
+
[[7, 4, 2, 6, 8, 9, 1, 3, 5],
|
307
|
+
[8, 3, 6, "-", 5, 1, 7, 2, 9],
|
308
|
+
[1, 5, 9, 3, 2, 7, 6, 4, 8],
|
309
|
+
[4, 1, 3, 8, 9, "-", 2, 5, 6],
|
310
|
+
[2, 7, 8, 1, 6, 5, 3, 9, 4],
|
311
|
+
[6, 9, 5, 2, 4, 3, 8, 7, 1],
|
312
|
+
[3, 8, 4, 7, 5, 6, 9, 1, 2],
|
313
|
+
[5, 2, 1, 9, 3, 8, 4, 6, 7],
|
314
|
+
[9, 6, 7, 4, 1, 2, 5, 8, 3]],
|
315
|
+
:duration=>0.021681,
|
316
|
+
:starting_dash_count=>51,
|
317
|
+
:ending_dash_count=>2},
|
318
|
+
{:round=>5,
|
319
|
+
:rounds=>15,
|
320
|
+
:solved=>true,
|
321
|
+
:starting_board=>
|
322
|
+
[[6, "-", 8, 7, 3, "-", "-", "-", "-"],
|
323
|
+
[2, "-", "-", "-", "-", "-", 4, 6, "-"],
|
324
|
+
["-", "-", "-", "-", 6, 4, 8, 2, "-"],
|
325
|
+
["-", 8, "-", "-", "-", 5, 7, "-", 1],
|
326
|
+
[9, "-", "-", 6, 1, 8, "-", "-", 4],
|
327
|
+
["-", 3, 1, "-", "-", "-", "-", 8, "-"],
|
328
|
+
[8, 6, "-", 2, "-", "-", "-", 3, 9],
|
329
|
+
["-", 5, "-", "-", "-", "-", 1, "-", "-"],
|
330
|
+
[1, "-", "-", 4, 5, 6, 2, "-", "-"]],
|
331
|
+
:final_board=>
|
332
|
+
[[6, 4, 8, 7, 3, 2, 9, 1, 5],
|
333
|
+
[2, 7, 5, 1, 8, 9, 4, 6, 3],
|
334
|
+
[3, 1, 9, 5, 6, 4, 8, 2, 7],
|
335
|
+
[4, 8, 6, 3, 2, 5, 7, 9, 1],
|
336
|
+
[9, 2, 7, 6, 1, 8, 3, 5, 4],
|
337
|
+
[5, 3, 1, 9, 4, 7, 6, 8, 2],
|
338
|
+
[8, 6, 4, 2, 7, 1, 5, 3, 9],
|
339
|
+
[7, 5, 2, 8, 9, 3, 1, 4, 6],
|
340
|
+
[1, 9, 3, 4, 5, 6, 2, 7, 8]],
|
341
|
+
:duration=>0.002506,
|
342
|
+
:starting_dash_count=>46,
|
343
|
+
:ending_dash_count=>0},
|
344
|
+
{:round=>4,
|
345
|
+
:rounds=>15,
|
346
|
+
:solved=>true,
|
347
|
+
:starting_board=>
|
348
|
+
[["-", 8, "-", "-", 2, "-", "-", "-", "-"],
|
349
|
+
["-", 4, "-", 5, "-", "-", 3, 2, "-"],
|
350
|
+
["-", 2, "-", 3, "-", 9, "-", 4, 6],
|
351
|
+
[6, "-", "-", "-", 9, "-", "-", "-", 4],
|
352
|
+
["-", "-", "-", 6, 4, "-", 5, "-", 1],
|
353
|
+
[1, 3, 4, "-", 5, "-", 7, "-", "-"],
|
354
|
+
[3, 6, "-", "-", "-", 4, "-", "-", 2],
|
355
|
+
[4, "-", 7, 2, 3, "-", 6, "-", "-"],
|
356
|
+
["-", "-", "-", 7, "-", "-", 4, 5, "-"]],
|
357
|
+
:final_board=>
|
358
|
+
[[7, 8, 3, 4, 2, 6, 9, 1, 5],
|
359
|
+
[9, 4, 6, 5, 1, 8, 3, 2, 7],
|
360
|
+
[5, 2, 1, 3, 7, 9, 8, 4, 6],
|
361
|
+
[6, 5, 8, 1, 9, 7, 2, 3, 4],
|
362
|
+
[2, 7, 9, 6, 4, 3, 5, 8, 1],
|
363
|
+
[1, 3, 4, 8, 5, 2, 7, 6, 9],
|
364
|
+
[3, 6, 5, 9, 8, 4, 1, 7, 2],
|
365
|
+
[4, 1, 7, 2, 3, 5, 6, 9, 8],
|
366
|
+
[8, 9, 2, 7, 6, 1, 4, 5, 3]],
|
367
|
+
:duration=>0.004042,
|
368
|
+
:starting_dash_count=>46,
|
369
|
+
:ending_dash_count=>0},
|
370
|
+
{:round=>3,
|
371
|
+
:rounds=>15,
|
372
|
+
:solved=>true,
|
373
|
+
:starting_board=>
|
374
|
+
[[2, 9, "-", 5, "-", "-", "-", "-", 7],
|
375
|
+
[7, "-", "-", "-", "-", "-", 4, "-", "-"],
|
376
|
+
["-", "-", 4, 7, 3, 8, "-", 1, 2],
|
377
|
+
[9, "-", 2, "-", "-", 3, "-", 6, 4],
|
378
|
+
[8, "-", "-", "-", 5, "-", "-", 7, "-"],
|
379
|
+
[5, "-", "-", "-", 6, 7, 2, "-", "-"],
|
380
|
+
[3, "-", 9, "-", "-", 4, "-", "-", 5],
|
381
|
+
["-", "-", "-", "-", 8, "-", 7, "-", "-"],
|
382
|
+
["-", 8, 7, "-", "-", 5, 1, "-", 9]],
|
383
|
+
:final_board=>
|
384
|
+
[[2, 9, 3, 5, 4, 1, 6, 8, 7],
|
385
|
+
[7, 1, 8, 2, 9, 6, 4, 5, 3],
|
386
|
+
[6, 5, 4, 7, 3, 8, 9, 1, 2],
|
387
|
+
[9, 7, 2, 8, 1, 3, 5, 6, 4],
|
388
|
+
[8, 4, 6, 9, 5, 2, 3, 7, 1],
|
389
|
+
[5, 3, 1, 4, 6, 7, 2, 9, 8],
|
390
|
+
[3, 6, 9, 1, 7, 4, 8, 2, 5],
|
391
|
+
[1, 2, 5, 3, 8, 9, 7, 4, 6],
|
392
|
+
[4, 8, 7, 6, 2, 5, 1, 3, 9]],
|
393
|
+
:duration=>0.003094,
|
394
|
+
:starting_dash_count=>46,
|
395
|
+
:ending_dash_count=>0},
|
396
|
+
{:round=>2,
|
397
|
+
:rounds=>15,
|
398
|
+
:solved=>true,
|
399
|
+
:starting_board=>
|
400
|
+
[["-", "-", 5, "-", 3, "-", "-", 8, 1],
|
401
|
+
[9, "-", 2, 8, 5, "-", "-", 6, "-"],
|
402
|
+
[6, "-", "-", "-", "-", 4, "-", 5, "-"],
|
403
|
+
["-", "-", 7, 4, "-", 2, 8, 3, "-"],
|
404
|
+
[3, 4, 9, 7, 6, "-", "-", "-", 5],
|
405
|
+
["-", "-", 8, 3, "-", "-", 4, 9, "-"],
|
406
|
+
[1, 5, "-", "-", 8, 7, "-", "-", 2],
|
407
|
+
["-", 9, "-", "-", "-", "-", 6, "-", "-"],
|
408
|
+
["-", 2, 6, "-", 4, 9, 5, "-", 3]],
|
409
|
+
:final_board=>
|
410
|
+
[[4, 7, 5, 9, 3, 6, 2, 8, 1],
|
411
|
+
[9, 3, 2, 8, 5, 1, 7, 6, 4],
|
412
|
+
[6, 8, 1, 2, 7, 4, 3, 5, 9],
|
413
|
+
[5, 1, 7, 4, 9, 2, 8, 3, 6],
|
414
|
+
[3, 4, 9, 7, 6, 8, 1, 2, 5],
|
415
|
+
[2, 6, 8, 3, 1, 5, 4, 9, 7],
|
416
|
+
[1, 5, 3, 6, 8, 7, 9, 4, 2],
|
417
|
+
[7, 9, 4, 5, 2, 3, 6, 1, 8],
|
418
|
+
[8, 2, 6, 1, 4, 9, 5, 7, 3]],
|
419
|
+
:duration=>0.001546,
|
420
|
+
:starting_dash_count=>41,
|
421
|
+
:ending_dash_count=>0},
|
422
|
+
{:round=>1,
|
423
|
+
:rounds=>15,
|
424
|
+
:solved=>true,
|
425
|
+
:starting_board=>
|
426
|
+
[[1, "-", 5, 8, "-", 2, "-", "-", "-"],
|
427
|
+
["-", 9, "-", "-", 7, 6, 4, "-", 5],
|
428
|
+
[2, "-", "-", 4, "-", "-", 8, 1, 9],
|
429
|
+
["-", 1, 9, "-", "-", 7, 3, "-", 6],
|
430
|
+
[7, 6, 2, "-", 8, 3, "-", 9, "-"],
|
431
|
+
["-", "-", "-", "-", 6, 1, "-", 5, "-"],
|
432
|
+
["-", "-", 7, 6, "-", "-", "-", 3, "-"],
|
433
|
+
[4, 3, "-", "-", 2, "-", 5, "-", 1],
|
434
|
+
[6, "-", "-", 3, "-", 8, 9, "-", "-"]],
|
435
|
+
:final_board=>
|
436
|
+
[[1, 4, 5, 8, 9, 2, 6, 7, 3],
|
437
|
+
[8, 9, 3, 1, 7, 6, 4, 2, 5],
|
438
|
+
[2, 7, 6, 4, 3, 5, 8, 1, 9],
|
439
|
+
[5, 1, 9, 2, 4, 7, 3, 8, 6],
|
440
|
+
[7, 6, 2, 5, 8, 3, 1, 9, 4],
|
441
|
+
[3, 8, 4, 9, 6, 1, 7, 5, 2],
|
442
|
+
[9, 5, 7, 6, 1, 4, 2, 3, 8],
|
443
|
+
[4, 3, 8, 7, 2, 9, 5, 6, 1],
|
444
|
+
[6, 2, 1, 3, 5, 8, 9, 4, 7]],
|
445
|
+
:duration=>0.001523,
|
446
|
+
:starting_dash_count=>41,
|
447
|
+
:ending_dash_count=>0}
|
448
|
+
]
|
449
|
+
```
|
450
|
+
|
29
451
|
|
30
452
|
## Development
|
31
453
|
|
data/Rakefile
CHANGED
@@ -14,24 +14,36 @@ task :test => :spec
|
|
14
14
|
task :console do
|
15
15
|
require 'irb'
|
16
16
|
require 'irb/completion'
|
17
|
-
require '
|
17
|
+
require 'sudoku_genius'
|
18
18
|
require "active_support/all"
|
19
19
|
ARGV.clear
|
20
20
|
|
21
|
-
|
22
|
-
scraped_links = run_sudoku
|
23
|
-
# binding.pry
|
21
|
+
result = play
|
24
22
|
|
25
23
|
IRB.start
|
26
24
|
end
|
27
25
|
|
28
26
|
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
def play
|
28
|
+
|
29
|
+
puzzles = %w[
|
30
|
+
1-58-2----9--764-52--4--819-19--73-6762-83-9-----61-5---76---3-43--2-5-16--3-89--
|
31
|
+
--5-3--819-285--6-6----4-5---74-283-34976---5--83--49-15--87--2-9----6---26-495-3
|
32
|
+
29-5----77-----4----4738-129-2--3-648---5--7-5---672--3-9--4--5----8-7---87--51-9
|
33
|
+
-8--2-----4-5--32--2-3-9-466---9---4---64-5-1134-5-7--36---4--24-723-6-----7--45-
|
34
|
+
6-873----2-----46-----6482--8---57-19--618--4-31----8-86-2---39-5----1--1--4562--
|
35
|
+
---6891--8------2915------84-3----5-2----5----9-24-8-1-847--91-5------6--6-41----
|
36
|
+
-3-5--8-45-42---1---8--9---79-8-61-3-----54---5------78-----7-2---7-46--61-3--5--
|
37
|
+
-96-4---11---6---45-481-39---795--43-3--8----4-5-23-18-1-63--59-59-7-83---359---7
|
38
|
+
----754----------8-8-19----3----1-6--------34----6817-2-4---6-39------2-53-2-----
|
39
|
+
3---------5-7-3--8----28-7-7------43-----------39-41-54--3--8--1---4----968---2--
|
40
|
+
3-26-9--55--73----------9-----94----------1-9----57-6---85----6--------3-19-82-4-
|
41
|
+
-2-5----48-5--------48-9-2------5-73-9-----6-25-9------3-6-18--------4-71----4-9-
|
42
|
+
----------2-65-------18--4--9----6-4-3---57-------------------73------9----------
|
43
|
+
8----------36------7--9-2---5---7-------457-----1---3---1----68--85---1--9----4--
|
44
|
+
---------------------------------------------------------------------------------
|
45
|
+
]
|
46
|
+
|
47
|
+
result = SudokuGenius.play(puzzles: puzzles)
|
36
48
|
# scraper = LinkScraper::Scrape.new(WebsCriteria.all_scrub_web_criteria)
|
37
49
|
end
|
data/lib/sudoku_genius.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
require "sudoku_genius/version"
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "sudoku_genius/solver"
|
4
4
|
# require 'mechanizer'
|
5
5
|
# require 'scrub_db'
|
6
6
|
require 'pry'
|
7
7
|
|
8
8
|
module SudokuGenius
|
9
|
-
|
9
|
+
|
10
|
+
def self.play(args={})
|
11
|
+
results = self::Solver.new.play(args)
|
12
|
+
end
|
13
|
+
|
10
14
|
end
|
data/lib/sudoku_genius/solver.rb
CHANGED
@@ -3,9 +3,244 @@ module SudokuGenius
|
|
3
3
|
class Solver
|
4
4
|
|
5
5
|
def initialize
|
6
|
-
|
6
|
+
@starting_dash_count = 0
|
7
|
+
@ending_dash_count = 0
|
8
|
+
@starting_board = nil
|
9
|
+
@final_board = []
|
10
|
+
@solved = nil
|
11
|
+
@start_time = Time.now
|
7
12
|
end
|
8
13
|
|
14
|
+
def refresh_values
|
15
|
+
initialize
|
16
|
+
end
|
17
|
+
|
18
|
+
# AlgoService.new.play
|
19
|
+
def play(args={})
|
20
|
+
sudoku_scores = []
|
21
|
+
puzzles = args.fetch(:puzzles, grab_puzzles)
|
22
|
+
total_rounds = puzzles.count
|
23
|
+
|
24
|
+
totals = puzzles.enum_for(:each_with_index).map do |puzzle,i|
|
25
|
+
refresh_values
|
26
|
+
starting_board = format_puzzle_string(puzzle)
|
27
|
+
starting_dash_count = get_dash_count_totals(starting_board)
|
28
|
+
start_puzzle(puzzle)
|
29
|
+
|
30
|
+
unless @solved == nil
|
31
|
+
sudoku_scores << { round: i+1,
|
32
|
+
rounds: total_rounds,
|
33
|
+
solved: @solved,
|
34
|
+
starting_board: remove_quotes(starting_board),
|
35
|
+
final_board: remove_quotes(@final_board),
|
36
|
+
duration: Time.now - @start_time,
|
37
|
+
starting_dash_count: starting_dash_count,
|
38
|
+
ending_dash_count: ending_dash_count = get_dash_count_totals(@final_board)
|
39
|
+
}
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
return sudoku_scores.reverse
|
44
|
+
end
|
45
|
+
|
46
|
+
def remove_quotes(rows)
|
47
|
+
rows.map! do |row|
|
48
|
+
row.map { |el| number_or_nil(el) }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def number_or_nil(string)
|
53
|
+
num = string.to_i
|
54
|
+
num.to_s == string ? num : string
|
55
|
+
end
|
56
|
+
|
57
|
+
def format_puzzle_string(puzzle_string)
|
58
|
+
rows = puzzle_string.chomp.chars.each_slice(9).to_a
|
59
|
+
end
|
60
|
+
|
61
|
+
def start_puzzle(puzzle_string)
|
62
|
+
rows = format_puzzle_string(puzzle_string)
|
63
|
+
data_hashes = find_dash_options(make_data_hash(rows))
|
64
|
+
updated_rows = fill_dashes(data_hashes, rows)
|
65
|
+
@final_board = updated_rows if !@final_board.any?
|
66
|
+
looper(puzzle_string, updated_rows)
|
67
|
+
end
|
68
|
+
|
69
|
+
def get_dash_count_totals(rows)
|
70
|
+
total_dash_count = rows.flatten.join.count "-"
|
71
|
+
end
|
72
|
+
|
73
|
+
def looper(puzzle_string, updated_rows)
|
74
|
+
starting_dash_count = get_dash_count_totals(updated_rows)
|
75
|
+
return solved?(updated_rows) if starting_dash_count == 0
|
76
|
+
data_hashes = find_dash_options(make_data_hash(updated_rows))
|
77
|
+
updated_rows = fill_dashes(data_hashes, updated_rows)
|
78
|
+
ending_dash_count = get_dash_count_totals(updated_rows)
|
79
|
+
return solved?(updated_rows) if ending_dash_count == 0
|
80
|
+
|
81
|
+
(ending_dash_count != starting_dash_count) ? looper(puzzle_string, updated_rows) : looper(puzzle_string, format_puzzle_string(puzzle_string))
|
82
|
+
end
|
83
|
+
|
84
|
+
def find_column(rows)
|
85
|
+
rows[0..-1].transpose.to_a
|
86
|
+
end
|
87
|
+
|
88
|
+
def find_dash_coords(rows)
|
89
|
+
coords = []
|
90
|
+
rows.each do |row|
|
91
|
+
if row.include?("-")
|
92
|
+
for col in 0...row.length
|
93
|
+
coords << [rows.index(row), col] if row[col] == '-'
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
coords
|
98
|
+
end
|
99
|
+
|
100
|
+
def find_box(rows)
|
101
|
+
boxes = [[]] * 9
|
102
|
+
boxes[0] = rows[0][0..2]+rows[1][0..2]+rows[2][0..2]
|
103
|
+
boxes[1] = rows[0][3..5]+rows[1][3..5]+rows[2][3..5]
|
104
|
+
boxes[2] = rows[0][6..8]+rows[1][6..8]+rows[2][6..8]
|
105
|
+
boxes[3] = rows[3][0..2]+rows[4][0..2]+rows[5][0..2]
|
106
|
+
boxes[4] = rows[3][3..5]+rows[4][3..5]+rows[5][3..5]
|
107
|
+
boxes[5] = rows[3][6..8]+rows[4][6..8]+rows[5][6..8]
|
108
|
+
boxes[6] = rows[6][0..2]+rows[7][0..2]+rows[8][0..2]
|
109
|
+
boxes[7] = rows[6][3..5]+rows[7][3..5]+rows[8][3..5]
|
110
|
+
boxes[8] = rows[6][6..8]+rows[7][6..8]+rows[8][6..8]
|
111
|
+
boxes
|
112
|
+
end
|
113
|
+
|
114
|
+
def make_data_hash(rows)
|
115
|
+
cols = find_column(rows)
|
116
|
+
all_dash_coords = find_dash_coords(rows)
|
117
|
+
boxes = find_box(rows)
|
118
|
+
|
119
|
+
data = []
|
120
|
+
|
121
|
+
all_dash_coords.each do |coords|
|
122
|
+
r_i = coords[0]
|
123
|
+
c_i = coords[1]
|
124
|
+
|
125
|
+
data_hash = {coords: coords, row: rows[r_i], col: cols[c_i] }
|
126
|
+
|
127
|
+
if (0..2) === r_i && (0..2) === c_i
|
128
|
+
data_hash[:box] = boxes[0]
|
129
|
+
elsif (0..2) === r_i && (3..5) === c_i
|
130
|
+
data_hash[:box] = boxes[1]
|
131
|
+
elsif (0..2) === r_i && (6..8) === c_i
|
132
|
+
data_hash[:box] = boxes[2]
|
133
|
+
elsif (3..5) === r_i && (0..2) === c_i
|
134
|
+
data_hash[:box] = boxes[3]
|
135
|
+
elsif (3..5) === r_i && (3..5) === c_i
|
136
|
+
data_hash[:box] = boxes[4]
|
137
|
+
elsif (3..5) === r_i && (6..8) === c_i
|
138
|
+
data_hash[:box] = boxes[5]
|
139
|
+
elsif (6..8) === r_i && (0..2) === c_i
|
140
|
+
data_hash[:box] = boxes[6]
|
141
|
+
elsif (6..8) === r_i && (3..5) === c_i
|
142
|
+
data_hash[:box] = boxes[7]
|
143
|
+
elsif (6..8) === r_i && (6..8) === c_i
|
144
|
+
data_hash[:box] = boxes[8]
|
145
|
+
end
|
146
|
+
data << data_hash
|
147
|
+
end
|
148
|
+
data
|
149
|
+
end
|
150
|
+
|
151
|
+
def find_dash_options(data_hashes)
|
152
|
+
all_numbers = (1..9).to_a
|
153
|
+
data_hashes.each do |data_hash|
|
154
|
+
numbers_played = data_hash[:row] + data_hash[:col] + data_hash[:box]
|
155
|
+
numbers_played.uniq!.delete("-")
|
156
|
+
options = all_numbers - numbers_played.map!(&:to_i)
|
157
|
+
data_hash[:options] = options
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def get_lowest_option_count_hash(data_hashes)
|
162
|
+
counter = 0
|
163
|
+
lowest_option_count_hash = nil
|
164
|
+
while !lowest_option_count_hash && counter < 10
|
165
|
+
counter += 1
|
166
|
+
lowest_option_count_hash = data_hashes.find { |hash| hash[:options].count == counter }
|
167
|
+
end
|
168
|
+
lowest_option_count_hash
|
169
|
+
end
|
170
|
+
|
171
|
+
def fill_dashes(data_hashes, rows)
|
172
|
+
lowest_option_count_hash = get_lowest_option_count_hash(data_hashes)
|
173
|
+
|
174
|
+
if !lowest_option_count_hash.nil?
|
175
|
+
lowest_option_count = lowest_option_count_hash[:options].count
|
176
|
+
|
177
|
+
if lowest_option_count == 1 ## fill dashes if only one option available.
|
178
|
+
data_hashes.each do |data_hash|
|
179
|
+
r_i = data_hash[:coords][0]
|
180
|
+
c_i = data_hash[:coords][1]
|
181
|
+
rows[r_i][c_i] = data_hash[:options].first if data_hash[:options].count == 1
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
if lowest_option_count > 1
|
186
|
+
r_i = lowest_option_count_hash[:coords][0]
|
187
|
+
c_i = lowest_option_count_hash[:coords][1]
|
188
|
+
rows[r_i][c_i] = lowest_option_count_hash[:options].sample
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
192
|
+
rows
|
193
|
+
end
|
194
|
+
|
195
|
+
|
196
|
+
def solved?(board)
|
197
|
+
puts "\n\n#{"="*25}\nThe board was solved!\n\n"
|
198
|
+
puts pretty_board(board)
|
199
|
+
@solved = true
|
200
|
+
return @solved
|
201
|
+
end
|
202
|
+
|
203
|
+
|
204
|
+
def pretty_board(board)
|
205
|
+
pretty_rows = board.map { |row| row.join(' ') }
|
206
|
+
pretty_rows.map! { |row| row.insert(-1, "\n") }
|
207
|
+
end
|
208
|
+
|
209
|
+
|
210
|
+
def grab_puzzles
|
211
|
+
%w[
|
212
|
+
1-58-2----9--764-52--4--819-19--73-6762-83-9-----61-5---76---3-43--2-5-16--3-89--
|
213
|
+
--5-3--819-285--6-6----4-5---74-283-34976---5--83--49-15--87--2-9----6---26-495-3
|
214
|
+
29-5----77-----4----4738-129-2--3-648---5--7-5---672--3-9--4--5----8-7---87--51-9
|
215
|
+
-8--2-----4-5--32--2-3-9-466---9---4---64-5-1134-5-7--36---4--24-723-6-----7--45-
|
216
|
+
6-873----2-----46-----6482--8---57-19--618--4-31----8-86-2---39-5----1--1--4562--
|
217
|
+
---6891--8------2915------84-3----5-2----5----9-24-8-1-847--91-5------6--6-41----
|
218
|
+
-3-5--8-45-42---1---8--9---79-8-61-3-----54---5------78-----7-2---7-46--61-3--5--
|
219
|
+
-96-4---11---6---45-481-39---795--43-3--8----4-5-23-18-1-63--59-59-7-83---359---7
|
220
|
+
----754----------8-8-19----3----1-6--------34----6817-2-4---6-39------2-53-2-----
|
221
|
+
3---------5-7-3--8----28-7-7------43-----------39-41-54--3--8--1---4----968---2--
|
222
|
+
3-26-9--55--73----------9-----94----------1-9----57-6---85----6--------3-19-82-4-
|
223
|
+
-2-5----48-5--------48-9-2------5-73-9-----6-25-9------3-6-18--------4-71----4-9-
|
224
|
+
----------2-65-------18--4--9----6-4-3---57-------------------73------9----------
|
225
|
+
8----------36------7--9-2---5---7-------457-----1---3---1----68--85---1--9----4--
|
226
|
+
---------------------------------------------------------------------------------
|
227
|
+
]
|
228
|
+
end
|
229
|
+
|
230
|
+
|
231
|
+
def grab_arto
|
232
|
+
# p = %w[8--------
|
233
|
+
# --36-----
|
234
|
+
# -7--9-2--
|
235
|
+
# -5---7---
|
236
|
+
# ----457--
|
237
|
+
# ---1---3-
|
238
|
+
# --1----68
|
239
|
+
# --85---1-
|
240
|
+
# -9----4--]
|
241
|
+
|
242
|
+
p = "8----------36------7--9-2---5---7-------457-----1---3---1----68--85---1--9----4--"
|
243
|
+
end
|
9
244
|
|
10
245
|
|
11
246
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
1-58-2----9--764-52--4--819-19--73-6762-83-9-----61-5---76---3-43--2-5-16--3-89--
|
2
|
+
--5-3--819-285--6-6----4-5---74-283-34976---5--83--49-15--87--2-9----6---26-495-3
|
3
|
+
29-5----77-----4----4738-129-2--3-648---5--7-5---672--3-9--4--5----8-7---87--51-9
|
4
|
+
-8--2-----4-5--32--2-3-9-466---9---4---64-5-1134-5-7--36---4--24-723-6-----7--45-
|
5
|
+
6-873----2-----46-----6482--8---57-19--618--4-31----8-86-2---39-5----1--1--4562--
|
6
|
+
---6891--8------2915------84-3----5-2----5----9-24-8-1-847--91-5------6--6-41----
|
7
|
+
-3-5--8-45-42---1---8--9---79-8-61-3-----54---5------78-----7-2---7-46--61-3--5--
|
8
|
+
-96-4---11---6---45-481-39---795--43-3--8----4-5-23-18-1-63--59-59-7-83---359---7
|
9
|
+
----754----------8-8-19----3----1-6--------34----6817-2-4---6-39------2-53-2-----
|
10
|
+
3---------5-7-3--8----28-7-7------43-----------39-41-54--3--8--1---4----968---2--
|
11
|
+
3-26-9--55--73----------9-----94----------1-9----57-6---85----6--------3-19-82-4-
|
12
|
+
-2-5----48-5--------48-9-2------5-73-9-----6-25-9------3-6-18--------4-71----4-9-
|
13
|
+
--7--8------2---6-65--79----7----3-5-83---67-2-1----8----71--38-2---5------4--2--
|
14
|
+
----------2-65-------18--4--9----6-4-3---57-------------------73------9----------
|
15
|
+
---------------------------------------------------------------------------------
|
data/sudoku_genius.gemspec
CHANGED
@@ -32,11 +32,11 @@ Gem::Specification.new do |spec|
|
|
32
32
|
|
33
33
|
spec.required_ruby_version = '~> 2.5.1'
|
34
34
|
spec.add_dependency 'activesupport', '~> 5.2'
|
35
|
-
spec.add_dependency 'crm_formatter', '~> 2.
|
35
|
+
spec.add_dependency 'crm_formatter', '~> 2.65'
|
36
36
|
spec.add_dependency 'mechanizer', '~> 1.12'
|
37
37
|
spec.add_dependency 'scrub_db', '~> 2.23'
|
38
38
|
spec.add_dependency 'url_verifier', '~> 2.12'
|
39
|
-
spec.add_dependency 'utf8_sanitizer', '~> 2.16'
|
39
|
+
# spec.add_dependency 'utf8_sanitizer', '~> 2.16'
|
40
40
|
|
41
41
|
# spec.add_dependency "activesupport-inflector", ['~> 0.1.0']
|
42
42
|
spec.add_development_dependency 'bundler', '~> 1.16', '>= 1.16.2'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sudoku_genius
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.02'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Booth
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
33
|
+
version: '2.65'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2.
|
40
|
+
version: '2.65'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mechanizer
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2.12'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: utf8_sanitizer
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '2.16'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '2.16'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: bundler
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,6 +168,7 @@ files:
|
|
182
168
|
- bin/setup
|
183
169
|
- lib/sudoku_genius.rb
|
184
170
|
- lib/sudoku_genius/solver.rb
|
171
|
+
- lib/sudoku_genius/sudoku_puzzles.txt
|
185
172
|
- lib/sudoku_genius/version.rb
|
186
173
|
- sudoku_genius.gemspec
|
187
174
|
homepage: https://github.com/4rlm/sudoku_genius
|