sudoku_builder 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/workspace.xml +178 -46
- data/Gemfile.lock +1 -1
- data/README.md +14 -8
- data/lib/sudoku_builder/builder.rb +3 -2
- data/lib/sudoku_builder/solver.rb +38 -24
- data/lib/sudoku_builder/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d31c9a419525975d9c40974e3963b227d70defee
|
4
|
+
data.tar.gz: 4bc3124d4e6dbc1760a42c66d5a865f65bfce958
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88d11bfc2e8efd7a6998f947a1f8d41321060574860ade5022bcfe00f4a609e54f9fcd927cdbd59505af7493445697bfeb9a1dc15db59d318f83ef11ca6c46dc
|
7
|
+
data.tar.gz: 3168bfb3fe236f11aeffefa8787f178d11a73a23f2192376e7cd55fe8d324e0b54dd4ff9d205472f5ae06ab02a07c3750649751fb5aa710800a6a462f41d2aab
|
data/.idea/workspace.xml
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
<project version="4">
|
3
3
|
<component name="ChangeListManager">
|
4
4
|
<list default="true" id="4ba0e926-77d1-4436-9c09-2db6ca58a641" name="Default" comment="">
|
5
|
-
<change type="MODIFICATION" beforePath="$PROJECT_DIR
|
5
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/Gemfile.lock" afterPath="$PROJECT_DIR$/Gemfile.lock" />
|
6
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
|
6
7
|
</list>
|
7
8
|
<ignored path="sudoku.iws" />
|
8
9
|
<ignored path=".idea/workspace.xml" />
|
@@ -26,7 +27,75 @@
|
|
26
27
|
<favorites_list name="sudoku" />
|
27
28
|
</component>
|
28
29
|
<component name="FileEditorManager">
|
29
|
-
<leaf
|
30
|
+
<leaf>
|
31
|
+
<file leaf-file-name="sudoku_builder.rb" pinned="false" current-in-tab="false">
|
32
|
+
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder.rb">
|
33
|
+
<provider selected="true" editor-type-id="text-editor">
|
34
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="345">
|
35
|
+
<caret line="13" column="7" selection-start-line="8" selection-start-column="4" selection-end-line="13" selection-end-column="7" />
|
36
|
+
<folding />
|
37
|
+
</state>
|
38
|
+
</provider>
|
39
|
+
</entry>
|
40
|
+
</file>
|
41
|
+
<file leaf-file-name="sudoku.rb" pinned="false" current-in-tab="false">
|
42
|
+
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder/sudoku.rb">
|
43
|
+
<provider selected="true" editor-type-id="text-editor">
|
44
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="375">
|
45
|
+
<caret line="9" column="14" selection-start-line="9" selection-start-column="14" selection-end-line="19" selection-end-column="7" />
|
46
|
+
<folding>
|
47
|
+
<marker date="1433391076000" expanded="false" signature="454:1587" placeholder="..." />
|
48
|
+
</folding>
|
49
|
+
</state>
|
50
|
+
</provider>
|
51
|
+
</entry>
|
52
|
+
</file>
|
53
|
+
<file leaf-file-name="solver.rb" pinned="false" current-in-tab="false">
|
54
|
+
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder/solver.rb">
|
55
|
+
<provider selected="true" editor-type-id="text-editor">
|
56
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="960">
|
57
|
+
<caret line="61" column="83" selection-start-line="61" selection-start-column="83" selection-end-line="61" selection-end-column="83" />
|
58
|
+
<folding>
|
59
|
+
<marker date="1433399816000" expanded="false" signature="274:1002" placeholder="..." />
|
60
|
+
</folding>
|
61
|
+
</state>
|
62
|
+
</provider>
|
63
|
+
</entry>
|
64
|
+
</file>
|
65
|
+
<file leaf-file-name="builder.rb" pinned="false" current-in-tab="false">
|
66
|
+
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder/builder.rb">
|
67
|
+
<provider selected="true" editor-type-id="text-editor">
|
68
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="746" max-vertical-offset="1425">
|
69
|
+
<caret line="52" column="8" selection-start-line="52" selection-start-column="8" selection-end-line="52" selection-end-column="8" />
|
70
|
+
<folding />
|
71
|
+
</state>
|
72
|
+
</provider>
|
73
|
+
</entry>
|
74
|
+
</file>
|
75
|
+
<file leaf-file-name="README.md" pinned="false" current-in-tab="false">
|
76
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
77
|
+
<provider editor-type-id="MarkdownPreviewEditor">
|
78
|
+
<state />
|
79
|
+
</provider>
|
80
|
+
<provider selected="true" editor-type-id="text-editor">
|
81
|
+
<state vertical-scroll-proportion="-8.1" vertical-offset="807" max-vertical-offset="1155">
|
82
|
+
<caret line="70" column="28" selection-start-line="70" selection-start-column="28" selection-end-line="70" selection-end-column="28" />
|
83
|
+
<folding />
|
84
|
+
</state>
|
85
|
+
</provider>
|
86
|
+
</entry>
|
87
|
+
</file>
|
88
|
+
<file leaf-file-name="version.rb" pinned="false" current-in-tab="true">
|
89
|
+
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder/version.rb">
|
90
|
+
<provider selected="true" editor-type-id="text-editor">
|
91
|
+
<state vertical-scroll-proportion="0.03968254" vertical-offset="0" max-vertical-offset="378">
|
92
|
+
<caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
|
93
|
+
<folding />
|
94
|
+
</state>
|
95
|
+
</provider>
|
96
|
+
</entry>
|
97
|
+
</file>
|
98
|
+
</leaf>
|
30
99
|
</component>
|
31
100
|
<component name="Git.Settings">
|
32
101
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
@@ -40,11 +109,15 @@
|
|
40
109
|
<option value="$PROJECT_DIR$/lib/sudoku/sudoku.rb" />
|
41
110
|
<option value="$PROJECT_DIR$/lib/sudoku/builder.rb" />
|
42
111
|
<option value="$PROJECT_DIR$/lib/sudoku/test_run.rb" />
|
43
|
-
<option value="$PROJECT_DIR$/spec/sudoku_spec.rb" />
|
44
112
|
<option value="$PROJECT_DIR$/.gitignore" />
|
45
113
|
<option value="$PROJECT_DIR$/sudoku.gemspec" />
|
46
114
|
<option value="$PROJECT_DIR$/sudoku_builder.gemspec" />
|
115
|
+
<option value="$PROJECT_DIR$/lib/sudoku_builder/version.rb" />
|
116
|
+
<option value="$PROJECT_DIR$/spec/sudoku_spec.rb" />
|
47
117
|
<option value="$PROJECT_DIR$/lib/sudoku_builder.rb" />
|
118
|
+
<option value="$PROJECT_DIR$/lib/sudoku_builder/solver.rb" />
|
119
|
+
<option value="$PROJECT_DIR$/lib/sudoku_builder/builder.rb" />
|
120
|
+
<option value="$PROJECT_DIR$/README.md" />
|
48
121
|
</list>
|
49
122
|
</option>
|
50
123
|
</component>
|
@@ -129,6 +202,20 @@
|
|
129
202
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
130
203
|
</PATH_ELEMENT>
|
131
204
|
</PATH>
|
205
|
+
<PATH>
|
206
|
+
<PATH_ELEMENT>
|
207
|
+
<option name="myItemId" value="sudoku" />
|
208
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
209
|
+
</PATH_ELEMENT>
|
210
|
+
<PATH_ELEMENT>
|
211
|
+
<option name="myItemId" value="sudoku" />
|
212
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
213
|
+
</PATH_ELEMENT>
|
214
|
+
<PATH_ELEMENT>
|
215
|
+
<option name="myItemId" value="bin" />
|
216
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
217
|
+
</PATH_ELEMENT>
|
218
|
+
</PATH>
|
132
219
|
</subPane>
|
133
220
|
</pane>
|
134
221
|
<pane id="Scope" />
|
@@ -137,6 +224,7 @@
|
|
137
224
|
<component name="PropertiesComponent">
|
138
225
|
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
139
226
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
227
|
+
<property name="FullScreen" value="false" />
|
140
228
|
</component>
|
141
229
|
<component name="RunManager">
|
142
230
|
<configuration default="true" type="RSpecRunConfigurationType" factoryName="RSpec">
|
@@ -223,6 +311,12 @@
|
|
223
311
|
<method />
|
224
312
|
</configuration>
|
225
313
|
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
|
314
|
+
<node-options />
|
315
|
+
<gulpfile />
|
316
|
+
<tasks />
|
317
|
+
<arguments />
|
318
|
+
<pass-parent-envs>true</pass-parent-envs>
|
319
|
+
<envs />
|
226
320
|
<method />
|
227
321
|
</configuration>
|
228
322
|
<list size="0" />
|
@@ -238,28 +332,28 @@
|
|
238
332
|
<servers />
|
239
333
|
</component>
|
240
334
|
<component name="ToolWindowManager">
|
241
|
-
<frame x="0" y="23" width="1280" height="773" extended-state="
|
335
|
+
<frame x="0" y="23" width="1280" height="773" extended-state="6" />
|
242
336
|
<editor active="false" />
|
243
337
|
<layout>
|
244
|
-
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="
|
245
|
-
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.
|
246
|
-
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
247
|
-
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32977098" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
248
|
-
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
249
|
-
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.63053435" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
250
|
-
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
251
|
-
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
338
|
+
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
339
|
+
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3847328" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
252
340
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
341
|
+
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
253
342
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
254
|
-
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="
|
255
|
-
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.
|
256
|
-
<window_info id="
|
343
|
+
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
344
|
+
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2536349" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
345
|
+
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
346
|
+
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32954547" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
347
|
+
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
348
|
+
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.63053435" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
349
|
+
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
257
350
|
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
258
351
|
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
259
352
|
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
353
|
+
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32977098" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
260
354
|
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
261
|
-
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
262
355
|
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
356
|
+
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
263
357
|
</layout>
|
264
358
|
</component>
|
265
359
|
<component name="Vcs.Log.UiProperties">
|
@@ -279,23 +373,44 @@
|
|
279
373
|
</option>
|
280
374
|
</component>
|
281
375
|
<component name="XDebuggerManager">
|
282
|
-
<breakpoint-manager
|
376
|
+
<breakpoint-manager>
|
377
|
+
<option name="time" value="1" />
|
378
|
+
</breakpoint-manager>
|
283
379
|
<watches-manager />
|
284
380
|
</component>
|
285
381
|
<component name="editorHistoryManager">
|
286
|
-
<entry file="file://$PROJECT_DIR$/
|
382
|
+
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder.rb">
|
287
383
|
<provider selected="true" editor-type-id="text-editor">
|
288
|
-
<state vertical-scroll-proportion="0.0" vertical-offset="
|
289
|
-
<caret line="
|
384
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="165" max-vertical-offset="345">
|
385
|
+
<caret line="11" column="20" selection-start-line="11" selection-start-column="20" selection-end-line="11" selection-end-column="20" />
|
290
386
|
<folding />
|
291
387
|
</state>
|
292
388
|
</provider>
|
293
389
|
</entry>
|
390
|
+
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder/sudoku.rb">
|
391
|
+
<provider selected="true" editor-type-id="text-editor">
|
392
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="135" max-vertical-offset="375">
|
393
|
+
<caret line="9" column="14" selection-start-line="9" selection-start-column="14" selection-end-line="19" selection-end-column="7" />
|
394
|
+
<folding>
|
395
|
+
<marker date="1433391076000" expanded="false" signature="454:1587" placeholder="..." />
|
396
|
+
</folding>
|
397
|
+
</state>
|
398
|
+
</provider>
|
399
|
+
</entry>
|
400
|
+
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder/solver.rb">
|
401
|
+
<provider selected="true" editor-type-id="text-editor">
|
402
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1065">
|
403
|
+
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
404
|
+
<folding>
|
405
|
+
<marker date="1433399816000" expanded="false" signature="274:1002" placeholder="..." />
|
406
|
+
</folding>
|
407
|
+
</state>
|
408
|
+
</provider>
|
409
|
+
</entry>
|
294
410
|
<entry file="file://$PROJECT_DIR$/.rspec">
|
295
411
|
<provider selected="true" editor-type-id="text-editor">
|
296
412
|
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="410">
|
297
413
|
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
298
|
-
<folding />
|
299
414
|
</state>
|
300
415
|
</provider>
|
301
416
|
</entry>
|
@@ -311,7 +426,6 @@
|
|
311
426
|
<provider selected="true" editor-type-id="text-editor">
|
312
427
|
<state vertical-scroll-proportion="-28.2" vertical-offset="0" max-vertical-offset="810">
|
313
428
|
<caret line="47" column="0" selection-start-line="47" selection-start-column="0" selection-end-line="47" selection-end-column="0" />
|
314
|
-
<folding />
|
315
429
|
</state>
|
316
430
|
</provider>
|
317
431
|
</entry>
|
@@ -319,7 +433,6 @@
|
|
319
433
|
<provider selected="true" editor-type-id="text-editor">
|
320
434
|
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="410">
|
321
435
|
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
322
|
-
<folding />
|
323
436
|
</state>
|
324
437
|
</provider>
|
325
438
|
</entry>
|
@@ -327,7 +440,6 @@
|
|
327
440
|
<provider selected="true" editor-type-id="text-editor">
|
328
441
|
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="630">
|
329
442
|
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
330
|
-
<folding />
|
331
443
|
</state>
|
332
444
|
</provider>
|
333
445
|
</entry>
|
@@ -341,59 +453,79 @@
|
|
341
453
|
</entry>
|
342
454
|
<entry file="file://$PROJECT_DIR$/sudoku_builder.gemspec">
|
343
455
|
<provider selected="true" editor-type-id="text-editor">
|
344
|
-
<state vertical-scroll-proportion="0.
|
345
|
-
<caret line="
|
456
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="15" max-vertical-offset="420">
|
457
|
+
<caret line="8" column="17" selection-start-line="8" selection-start-column="17" selection-end-line="8" selection-end-column="17" />
|
346
458
|
<folding />
|
347
459
|
</state>
|
348
460
|
</provider>
|
349
461
|
</entry>
|
350
|
-
<entry file="file://$PROJECT_DIR$/
|
351
|
-
<provider selected="true" editor-type-id="
|
352
|
-
<state
|
462
|
+
<entry file="file://$PROJECT_DIR$/spec/sudoku_spec.rb">
|
463
|
+
<provider selected="true" editor-type-id="text-editor">
|
464
|
+
<state vertical-scroll-proportion="0.14516129" vertical-offset="0" max-vertical-offset="1200">
|
465
|
+
<caret line="3" column="13" selection-start-line="3" selection-start-column="13" selection-end-line="3" selection-end-column="13" />
|
466
|
+
<folding />
|
467
|
+
</state>
|
353
468
|
</provider>
|
354
|
-
|
355
|
-
|
356
|
-
|
469
|
+
</entry>
|
470
|
+
<entry file="file://$USER_HOME$/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rexml/functions.rb">
|
471
|
+
<provider selected="true" editor-type-id="text-editor">
|
472
|
+
<state vertical-scroll-proportion="4.197349" vertical-offset="930" max-vertical-offset="6000">
|
473
|
+
<caret line="252" column="37" selection-start-line="252" selection-start-column="37" selection-end-line="252" selection-end-column="37" />
|
357
474
|
<folding />
|
358
475
|
</state>
|
359
476
|
</provider>
|
360
477
|
</entry>
|
361
|
-
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder
|
478
|
+
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder.rb">
|
362
479
|
<provider selected="true" editor-type-id="text-editor">
|
363
|
-
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="
|
364
|
-
<caret line="
|
480
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="345">
|
481
|
+
<caret line="13" column="7" selection-start-line="8" selection-start-column="4" selection-end-line="13" selection-end-column="7" />
|
365
482
|
<folding />
|
366
483
|
</state>
|
367
484
|
</provider>
|
368
485
|
</entry>
|
369
486
|
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder/sudoku.rb">
|
370
487
|
<provider selected="true" editor-type-id="text-editor">
|
371
|
-
<state vertical-scroll-proportion="0.
|
372
|
-
<caret line="
|
373
|
-
<folding
|
488
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="375">
|
489
|
+
<caret line="9" column="14" selection-start-line="9" selection-start-column="14" selection-end-line="19" selection-end-column="7" />
|
490
|
+
<folding>
|
491
|
+
<marker date="1433391076000" expanded="false" signature="454:1587" placeholder="..." />
|
492
|
+
</folding>
|
374
493
|
</state>
|
375
494
|
</provider>
|
376
495
|
</entry>
|
377
496
|
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder/solver.rb">
|
378
497
|
<provider selected="true" editor-type-id="text-editor">
|
379
|
-
<state vertical-scroll-proportion="0.
|
380
|
-
<caret line="
|
381
|
-
<folding
|
498
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="495" max-vertical-offset="960">
|
499
|
+
<caret line="61" column="83" selection-start-line="61" selection-start-column="83" selection-end-line="61" selection-end-column="83" />
|
500
|
+
<folding>
|
501
|
+
<marker date="1433399816000" expanded="false" signature="274:1002" placeholder="..." />
|
502
|
+
</folding>
|
382
503
|
</state>
|
383
504
|
</provider>
|
384
505
|
</entry>
|
385
506
|
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder/builder.rb">
|
386
507
|
<provider selected="true" editor-type-id="text-editor">
|
387
|
-
<state vertical-scroll-proportion="0.
|
388
|
-
<caret line="
|
508
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="746" max-vertical-offset="1425">
|
509
|
+
<caret line="52" column="8" selection-start-line="52" selection-start-column="8" selection-end-line="52" selection-end-column="8" />
|
389
510
|
<folding />
|
390
511
|
</state>
|
391
512
|
</provider>
|
392
513
|
</entry>
|
393
|
-
<entry file="file://$PROJECT_DIR$/
|
514
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
515
|
+
<provider selected="true" editor-type-id="text-editor">
|
516
|
+
<state vertical-scroll-proportion="-8.1" vertical-offset="807" max-vertical-offset="1155">
|
517
|
+
<caret line="70" column="28" selection-start-line="70" selection-start-column="28" selection-end-line="70" selection-end-column="28" />
|
518
|
+
<folding />
|
519
|
+
</state>
|
520
|
+
</provider>
|
521
|
+
<provider editor-type-id="MarkdownPreviewEditor">
|
522
|
+
<state />
|
523
|
+
</provider>
|
524
|
+
</entry>
|
525
|
+
<entry file="file://$PROJECT_DIR$/lib/sudoku_builder/version.rb">
|
394
526
|
<provider selected="true" editor-type-id="text-editor">
|
395
|
-
<state vertical-scroll-proportion="0.
|
396
|
-
<caret line="
|
527
|
+
<state vertical-scroll-proportion="0.03968254" vertical-offset="0" max-vertical-offset="378">
|
528
|
+
<caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
|
397
529
|
<folding />
|
398
530
|
</state>
|
399
531
|
</provider>
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,21 @@
|
|
1
1
|
# Sudoku
|
2
2
|
|
3
|
-
Welcome to
|
3
|
+
Welcome to `SudokuBuilder`. Build and fill out sudoku's with the same tool!
|
4
|
+
|
5
|
+
### Quick Start
|
6
|
+
`> require 'sudoku_builder'`
|
7
|
+
|
8
|
+
Run the following in the console:
|
9
|
+
`> SudokuBuilder.new.pretty_print`
|
10
|
+
|
4
11
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
12
|
|
7
13
|
## Installation
|
8
14
|
|
9
15
|
Add this line to your application's Gemfile:
|
10
16
|
|
11
17
|
```ruby
|
12
|
-
gem '
|
18
|
+
gem 'sudoku_builder'
|
13
19
|
```
|
14
20
|
|
15
21
|
And then execute:
|
@@ -18,18 +24,18 @@ And then execute:
|
|
18
24
|
|
19
25
|
Or install it yourself as:
|
20
26
|
|
21
|
-
$ gem install
|
27
|
+
$ gem install sudoku_builder
|
22
28
|
|
23
29
|
## Usage
|
24
30
|
|
25
31
|
To create a new puzzle:
|
26
32
|
|
27
|
-
`
|
33
|
+
`SudokuBuilder.new`
|
28
34
|
|
29
|
-
This will return a `
|
35
|
+
This will return a `SudokuBuilder::Builder` object that looks like this:
|
30
36
|
|
31
37
|
```ruby
|
32
|
-
#<
|
38
|
+
#<SudokuBuilder::Builder:0x007fdc729373e8 @sud={0=>[6], 1=>[8], 2=>[9], 3=>[5], 4=>[7], 5=>[2], 6=>[3], ...
|
33
39
|
```
|
34
40
|
|
35
41
|
On the builder object you can call a handful of different methods:
|
@@ -42,7 +48,7 @@ On the builder object you can call a handful of different methods:
|
|
42
48
|
|
43
49
|
To solve an existing puzzle, call:
|
44
50
|
|
45
|
-
`
|
51
|
+
`SudokuBuilder::Solver.new(my_puzzle).solve`
|
46
52
|
|
47
53
|
my_puzzle must be equal to a hash with keys from 0 to 80 and values equal to an integer for already given squares, and an array for empty squares. ie:
|
48
54
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), 'sudoku'))
|
2
2
|
|
3
3
|
module SudokuBuilder
|
4
|
-
class Builder <
|
4
|
+
class Builder < Sudoku
|
5
5
|
def initialize(sudoku)
|
6
6
|
@sud = sudoku
|
7
7
|
end
|
@@ -47,7 +47,8 @@ module SudokuBuilder
|
|
47
47
|
@sud.each do |k,v|
|
48
48
|
c = [] ; r = [] ; g = []
|
49
49
|
build_crg(k,c,r,g,@sud)
|
50
|
-
|
50
|
+
v.class == Array ? val = v[0] : val = v
|
51
|
+
if check?(val, c,r,g) # runs the check method used before on every value.
|
51
52
|
valid << false
|
52
53
|
else
|
53
54
|
valid << true
|
@@ -2,50 +2,64 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'sudoku'))
|
|
2
2
|
require File.expand_path(File.join(File.dirname(__FILE__), 'builder'))
|
3
3
|
|
4
4
|
module SudokuBuilder
|
5
|
-
class Solver <
|
5
|
+
class Solver < Sudoku
|
6
6
|
|
7
7
|
def initialize(sudoku)
|
8
8
|
@sud = sudoku
|
9
9
|
@pristine = sudoku
|
10
|
-
@used =
|
10
|
+
@used = {
|
11
|
+
0=> [], 1=> [], 2=> [], 3=> [], 4=> [], 5=> [], 6=> [], 7=> [], 8=> [],
|
12
|
+
9=> [], 10=>[], 11=>[], 12=>[], 13=>[], 14=>[], 15=>[], 16=>[], 17=>[],
|
13
|
+
18=>[], 19=>[], 20=>[], 21=>[], 22=>[], 23=>[], 24=>[], 25=>[], 26=>[],
|
14
|
+
27=>[], 28=>[], 29=>[], 30=>[], 31=>[], 32=>[], 33=>[], 34=>[], 35=>[],
|
15
|
+
36=>[], 37=>[], 38=>[], 39=>[], 40=>[], 41=>[], 42=>[], 43=>[], 44=>[],
|
16
|
+
45=>[], 46=>[], 47=>[], 48=>[], 49=>[], 50=>[], 51=>[], 52=>[], 53=>[],
|
17
|
+
54=>[], 55=>[], 56=>[], 57=>[], 58=>[], 59=>[], 60=>[], 61=>[], 62=>[],
|
18
|
+
63=>[], 64=>[], 65=>[], 66=>[], 67=>[], 68=>[], 69=>[], 70=>[], 71=>[],
|
19
|
+
72=>[], 73=>[], 74=>[], 75=>[], 76=>[], 77=>[], 78=>[], 79=>[], 80=>[]
|
20
|
+
}
|
11
21
|
end
|
12
22
|
|
13
23
|
# solve any given sudoku. If the sudoku is empty, it will build a complete one.
|
14
24
|
def solve
|
15
|
-
t = 0 ; o = 0
|
16
|
-
key = 0
|
25
|
+
t = 0 ; o = 0 ;
|
26
|
+
direction = true ; key = 0 # main key variable.
|
17
27
|
loop do
|
18
|
-
if @sud[key].class == Array
|
19
|
-
c = [] ; r = [] ; g = []
|
20
|
-
build_crg(key,c,r,g,@sud)
|
21
|
-
@sud[key] = []
|
28
|
+
if @sud[key].class == Array # skips pre-filled numbers.
|
29
|
+
c = [] ; r = [] ; g = [] # build values for current grid, row, column.
|
30
|
+
build_crg(key,c,r,g,@sud) # updates the relevant variables for check.
|
31
|
+
@sud[key] = [] # makes a fresh possibilities array.
|
22
32
|
for i in 1..9
|
23
33
|
if check?(i, c,r,g) &&
|
24
|
-
|
34
|
+
!@used[key].include?(i)
|
25
35
|
@sud[key] << i
|
26
36
|
end
|
27
37
|
end
|
28
|
-
if @sud[key].count == 0
|
38
|
+
if @sud[key].count == 0 # backtrack if no possibilities.
|
29
39
|
key -= 1
|
40
|
+
direction = false
|
30
41
|
else
|
31
|
-
use = @sud[key].sample
|
32
|
-
@sud[key] = [use]
|
33
|
-
@used[key] << use
|
42
|
+
use = @sud[key].sample # pick a random possibility.
|
43
|
+
@sud[key] = [use] # uses the possibility.
|
44
|
+
@used[key] << use # also puts it into the used array.
|
34
45
|
key += 1
|
46
|
+
direction = true
|
35
47
|
end
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
48
|
+
elsif @sud[key].class == Fixnum
|
49
|
+
direction ? key += 1 : key -= 1 # backt or forward track based on current direction.
|
50
|
+
end
|
51
|
+
if key == 0 || t > 104 ||
|
52
|
+
key == 1 && t > 3 # resets everything if we've reached a high amount
|
53
|
+
@sud = @pristine.dup # of run throughs, or the key has wound down to 0.
|
54
|
+
@used.each do |k,v|
|
55
|
+
@used[k] = []
|
40
56
|
end
|
41
|
-
|
42
|
-
|
57
|
+
key = 0 ; t = 0
|
58
|
+
direction = true
|
43
59
|
end
|
44
|
-
break if key == 81
|
45
|
-
t += 1 ; o += 1
|
46
|
-
break if o > 1000000
|
47
|
-
# unsolvable puzzle, this breaks if the number
|
48
|
-
# of run throughs is really really high.
|
60
|
+
break if key == 81 # break if we've reached the last value.
|
61
|
+
t += 1 ; o += 1 # add the reporting variables
|
62
|
+
break if o > 1000000 # there is the possibility to be given an
|
49
63
|
end
|
50
64
|
Builder.new(@sud)
|
51
65
|
end
|