sudoku_builder 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c79901254ba69dc330d00c53542cd3befd8fbef5
4
+ data.tar.gz: 97d94b440c15217c46205cb8e7a8aa24a3bfe404
5
+ SHA512:
6
+ metadata.gz: a691aa4778feea823ee36b77ed07d8744156e67c4993351e22567b7718f8d9b78be953eabbabbb6f7133ee9fd3059b0f46e50a7b92fa874473065774de742a5d
7
+ data.tar.gz: a158488e1e42782b5f66354188e5b7d6f40d69f763c70c80b8e9b034737f04ce90d9a04258412bd351d84fea70626180798d48213cdd9913834d09418e5c0cc9
data/.gitignore ADDED
@@ -0,0 +1,48 @@
1
+ <<<<<<< HEAD
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ =======
12
+ *.gem
13
+ *.rbc
14
+ /.config
15
+ /coverage/
16
+ /InstalledFiles
17
+ /pkg/
18
+ /spec/reports/
19
+ /test/tmp/
20
+ /test/version_tmp/
21
+ /tmp/
22
+
23
+ ## Specific to RubyMotion:
24
+ .dat*
25
+ .repl_history
26
+ build/
27
+
28
+ ## Documentation cache and generated files:
29
+ /.yardoc/
30
+ /_yardoc/
31
+ /doc/
32
+ /rdoc/
33
+
34
+ ## Environment normalisation:
35
+ /.bundle/
36
+ /vendor/bundle
37
+ /lib/bundler/man/
38
+
39
+ # for a library or gem, you might want to ignore these files since the code is
40
+ # intended to run in multiple environments; otherwise, check them in:
41
+ # Gemfile.lock
42
+ # .ruby-version
43
+ # .ruby-gemset
44
+
45
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
46
+ .rvmrc
47
+ >>>>>>> 672b09b6331859edf9d3a2a39930340418f78e37
48
+
data/.idea/.name ADDED
@@ -0,0 +1 @@
1
+ sudoku
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build sudoku-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install sudoku-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v0.1.0 and build and push sudoku-0.1.0.gem to Rubygems" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
+ </project>
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.2.1" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/sudoku.iml" filepath="$PROJECT_DIR$/.idea/sudoku.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,5 @@
1
+ <component name="DependencyValidationManager">
2
+ <state>
3
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
4
+ </state>
5
+ </component>
data/.idea/sudoku.iml ADDED
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="FacetManager">
4
+ <facet type="gem" name="Ruby Gem">
5
+ <configuration>
6
+ <option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
7
+ <option name="GEM_APP_TEST_PATH" value="" />
8
+ <option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
9
+ </configuration>
10
+ </facet>
11
+ </component>
12
+ <component name="NewModuleRootManager">
13
+ <content url="file://$MODULE_DIR$" />
14
+ <orderEntry type="inheritedJdk" />
15
+ <orderEntry type="sourceFolder" forTests="false" />
16
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, rbenv: 2.2.1) [gem]" level="application" />
17
+ </component>
18
+ </module>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,402 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="4ba0e926-77d1-4436-9c09-2db6ca58a641" name="Default" comment="">
5
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
6
+ </list>
7
+ <ignored path="sudoku.iws" />
8
+ <ignored path=".idea/workspace.xml" />
9
+ <ignored path=".idea/dataSources.local.xml" />
10
+ <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
11
+ <option name="TRACKING_ENABLED" value="true" />
12
+ <option name="SHOW_DIALOG" value="false" />
13
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
14
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
15
+ <option name="LAST_RESOLUTION" value="IGNORE" />
16
+ </component>
17
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
18
+ <component name="CreatePatchCommitExecutor">
19
+ <option name="PATCH_PATH" value="" />
20
+ </component>
21
+ <component name="DaemonCodeAnalyzer">
22
+ <disable_hints />
23
+ </component>
24
+ <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
25
+ <component name="FavoritesManager">
26
+ <favorites_list name="sudoku" />
27
+ </component>
28
+ <component name="FileEditorManager">
29
+ <leaf />
30
+ </component>
31
+ <component name="Git.Settings">
32
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
33
+ </component>
34
+ <component name="IdeDocumentHistory">
35
+ <option name="CHANGED_PATHS">
36
+ <list>
37
+ <option value="$PROJECT_DIR$/lib/sudoku/object.rb" />
38
+ <option value="$PROJECT_DIR$/lib/sudoku.rb" />
39
+ <option value="$PROJECT_DIR$/lib/sudoku/solver.rb" />
40
+ <option value="$PROJECT_DIR$/lib/sudoku/sudoku.rb" />
41
+ <option value="$PROJECT_DIR$/lib/sudoku/builder.rb" />
42
+ <option value="$PROJECT_DIR$/lib/sudoku/test_run.rb" />
43
+ <option value="$PROJECT_DIR$/spec/sudoku_spec.rb" />
44
+ <option value="$PROJECT_DIR$/.gitignore" />
45
+ <option value="$PROJECT_DIR$/sudoku.gemspec" />
46
+ <option value="$PROJECT_DIR$/sudoku_builder.gemspec" />
47
+ <option value="$PROJECT_DIR$/lib/sudoku_builder.rb" />
48
+ </list>
49
+ </option>
50
+ </component>
51
+ <component name="JsGulpfileManager">
52
+ <detection-done>true</detection-done>
53
+ </component>
54
+ <component name="ProjectFrameBounds">
55
+ <option name="y" value="23" />
56
+ <option name="width" value="1280" />
57
+ <option name="height" value="773" />
58
+ </component>
59
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
60
+ <OptionsSetting value="true" id="Add" />
61
+ <OptionsSetting value="true" id="Remove" />
62
+ <OptionsSetting value="true" id="Checkout" />
63
+ <OptionsSetting value="true" id="Update" />
64
+ <OptionsSetting value="true" id="Status" />
65
+ <OptionsSetting value="true" id="Edit" />
66
+ <ConfirmationsSetting value="2" id="Add" />
67
+ <ConfirmationsSetting value="0" id="Remove" />
68
+ </component>
69
+ <component name="ProjectView">
70
+ <navigator currentView="ProjectPane" proportions="" version="1">
71
+ <flattenPackages />
72
+ <showMembers />
73
+ <showModules />
74
+ <showLibraryContents />
75
+ <hideEmptyPackages />
76
+ <abbreviatePackageNames />
77
+ <autoscrollToSource />
78
+ <autoscrollFromSource />
79
+ <sortByType />
80
+ </navigator>
81
+ <panes>
82
+ <pane id="ProjectPane">
83
+ <subPane>
84
+ <PATH>
85
+ <PATH_ELEMENT>
86
+ <option name="myItemId" value="sudoku" />
87
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
88
+ </PATH_ELEMENT>
89
+ </PATH>
90
+ <PATH>
91
+ <PATH_ELEMENT>
92
+ <option name="myItemId" value="sudoku" />
93
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
94
+ </PATH_ELEMENT>
95
+ <PATH_ELEMENT>
96
+ <option name="myItemId" value="sudoku" />
97
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
98
+ </PATH_ELEMENT>
99
+ </PATH>
100
+ <PATH>
101
+ <PATH_ELEMENT>
102
+ <option name="myItemId" value="sudoku" />
103
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
104
+ </PATH_ELEMENT>
105
+ <PATH_ELEMENT>
106
+ <option name="myItemId" value="sudoku" />
107
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
108
+ </PATH_ELEMENT>
109
+ <PATH_ELEMENT>
110
+ <option name="myItemId" value="lib" />
111
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
112
+ </PATH_ELEMENT>
113
+ </PATH>
114
+ <PATH>
115
+ <PATH_ELEMENT>
116
+ <option name="myItemId" value="sudoku" />
117
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
118
+ </PATH_ELEMENT>
119
+ <PATH_ELEMENT>
120
+ <option name="myItemId" value="sudoku" />
121
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
122
+ </PATH_ELEMENT>
123
+ <PATH_ELEMENT>
124
+ <option name="myItemId" value="lib" />
125
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
126
+ </PATH_ELEMENT>
127
+ <PATH_ELEMENT>
128
+ <option name="myItemId" value="sudoku_builder" />
129
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
130
+ </PATH_ELEMENT>
131
+ </PATH>
132
+ </subPane>
133
+ </pane>
134
+ <pane id="Scope" />
135
+ </panes>
136
+ </component>
137
+ <component name="PropertiesComponent">
138
+ <property name="last_opened_file_path" value="$PROJECT_DIR$" />
139
+ <property name="WebServerToolWindowFactoryState" value="false" />
140
+ </component>
141
+ <component name="RunManager">
142
+ <configuration default="true" type="RSpecRunConfigurationType" factoryName="RSpec">
143
+ <predefined_log_file id="RUBY_RSPEC" enabled="true" />
144
+ <module name="" />
145
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
146
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
147
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
148
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
149
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
150
+ <envs />
151
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
152
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
153
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
154
+ <COVERAGE_PATTERN ENABLED="true">
155
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
156
+ </COVERAGE_PATTERN>
157
+ </EXTENSION>
158
+ <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
159
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
160
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
161
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
162
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
163
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
164
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
165
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
166
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
167
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
168
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
169
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
170
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
171
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
172
+ <method />
173
+ </configuration>
174
+ <configuration default="true" type="RubyRunConfigurationType" factoryName="Ruby">
175
+ <module name="" />
176
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
177
+ <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="" />
178
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
179
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
180
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
181
+ <envs />
182
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
183
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
184
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
185
+ <COVERAGE_PATTERN ENABLED="true">
186
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
187
+ </COVERAGE_PATTERN>
188
+ </EXTENSION>
189
+ <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
190
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="" />
191
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
192
+ <method />
193
+ </configuration>
194
+ <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
195
+ <method />
196
+ </configuration>
197
+ <configuration default="true" type="TestUnitRunConfigurationType" factoryName="Test::Unit/Shoulda/Minitest">
198
+ <predefined_log_file id="RUBY_TESTUNIT" enabled="true" />
199
+ <module name="" />
200
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
201
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
202
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
203
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
204
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
205
+ <envs />
206
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
207
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
208
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
209
+ <COVERAGE_PATTERN ENABLED="true">
210
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
211
+ </COVERAGE_PATTERN>
212
+ </EXTENSION>
213
+ <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
214
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
215
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
216
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
217
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="" />
218
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
219
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
220
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
221
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
222
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_OPTIONS" VALUE="" />
223
+ <method />
224
+ </configuration>
225
+ <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
226
+ <method />
227
+ </configuration>
228
+ <list size="0" />
229
+ </component>
230
+ <component name="ShelveChangesManager" show_recycled="false" />
231
+ <component name="TaskManager">
232
+ <task active="true" id="Default" summary="Default task">
233
+ <changelist id="4ba0e926-77d1-4436-9c09-2db6ca58a641" name="Default" comment="" />
234
+ <created>1433375567963</created>
235
+ <option name="number" value="Default" />
236
+ <updated>1433375567963</updated>
237
+ </task>
238
+ <servers />
239
+ </component>
240
+ <component name="ToolWindowManager">
241
+ <frame x="0" y="23" width="1280" height="773" extended-state="0" />
242
+ <editor active="false" />
243
+ <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="-1" side_tool="false" content_ui="tabs" />
245
+ <window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.5984733" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
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" />
252
+ <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" />
253
+ <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="-1" side_tool="false" content_ui="tabs" />
255
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24959612" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
256
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32977098" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
257
+ <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
+ <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
+ <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" />
260
+ <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
+ <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" />
263
+ </layout>
264
+ </component>
265
+ <component name="Vcs.Log.UiProperties">
266
+ <option name="RECENTLY_FILTERED_USER_GROUPS">
267
+ <collection />
268
+ </option>
269
+ <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
270
+ <collection />
271
+ </option>
272
+ </component>
273
+ <component name="VcsContentAnnotationSettings">
274
+ <option name="myLimit" value="2678400000" />
275
+ </component>
276
+ <component name="VcsManagerConfiguration">
277
+ <option name="myTodoPanelSettings">
278
+ <TodoPanelSettings />
279
+ </option>
280
+ </component>
281
+ <component name="XDebuggerManager">
282
+ <breakpoint-manager />
283
+ <watches-manager />
284
+ </component>
285
+ <component name="editorHistoryManager">
286
+ <entry file="file://$PROJECT_DIR$/spec/sudoku_spec.rb">
287
+ <provider selected="true" editor-type-id="text-editor">
288
+ <state vertical-scroll-proportion="0.0" vertical-offset="615" max-vertical-offset="1200">
289
+ <caret line="71" column="5" selection-start-line="71" selection-start-column="5" selection-end-line="71" selection-end-column="5" />
290
+ <folding />
291
+ </state>
292
+ </provider>
293
+ </entry>
294
+ <entry file="file://$PROJECT_DIR$/.rspec">
295
+ <provider selected="true" editor-type-id="text-editor">
296
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="410">
297
+ <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
298
+ <folding />
299
+ </state>
300
+ </provider>
301
+ </entry>
302
+ <entry file="file://$PROJECT_DIR$/Gemfile">
303
+ <provider selected="true" editor-type-id="text-editor">
304
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="410">
305
+ <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
306
+ <folding />
307
+ </state>
308
+ </provider>
309
+ </entry>
310
+ <entry file="file://$PROJECT_DIR$/.gitignore">
311
+ <provider selected="true" editor-type-id="text-editor">
312
+ <state vertical-scroll-proportion="-28.2" vertical-offset="0" max-vertical-offset="810">
313
+ <caret line="47" column="0" selection-start-line="47" selection-start-column="0" selection-end-line="47" selection-end-column="0" />
314
+ <folding />
315
+ </state>
316
+ </provider>
317
+ </entry>
318
+ <entry file="file://$PROJECT_DIR$/.travis.yml">
319
+ <provider selected="true" editor-type-id="text-editor">
320
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="410">
321
+ <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
322
+ <folding />
323
+ </state>
324
+ </provider>
325
+ </entry>
326
+ <entry file="file://$PROJECT_DIR$/bin/setup">
327
+ <provider selected="true" editor-type-id="text-editor">
328
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="630">
329
+ <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
330
+ <folding />
331
+ </state>
332
+ </provider>
333
+ </entry>
334
+ <entry file="file://$PROJECT_DIR$/bin/console">
335
+ <provider selected="true" editor-type-id="text-editor">
336
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="410">
337
+ <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
338
+ <folding />
339
+ </state>
340
+ </provider>
341
+ </entry>
342
+ <entry file="file://$PROJECT_DIR$/sudoku_builder.gemspec">
343
+ <provider selected="true" editor-type-id="text-editor">
344
+ <state vertical-scroll-proportion="0.52380955" vertical-offset="0" max-vertical-offset="630">
345
+ <caret line="22" column="0" selection-start-line="22" selection-start-column="0" selection-end-line="22" selection-end-column="0" />
346
+ <folding />
347
+ </state>
348
+ </provider>
349
+ </entry>
350
+ <entry file="file://$PROJECT_DIR$/README.md">
351
+ <provider selected="true" editor-type-id="MarkdownPreviewEditor">
352
+ <state />
353
+ </provider>
354
+ <provider editor-type-id="text-editor">
355
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="675">
356
+ <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
357
+ <folding />
358
+ </state>
359
+ </provider>
360
+ </entry>
361
+ <entry file="file://$PROJECT_DIR$/lib/sudoku_builder/version.rb">
362
+ <provider selected="true" editor-type-id="text-editor">
363
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="630">
364
+ <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
365
+ <folding />
366
+ </state>
367
+ </provider>
368
+ </entry>
369
+ <entry file="file://$PROJECT_DIR$/lib/sudoku_builder/sudoku.rb">
370
+ <provider selected="true" editor-type-id="text-editor">
371
+ <state vertical-scroll-proportion="0.5714286" vertical-offset="0" max-vertical-offset="630">
372
+ <caret line="24" column="0" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" />
373
+ <folding />
374
+ </state>
375
+ </provider>
376
+ </entry>
377
+ <entry file="file://$PROJECT_DIR$/lib/sudoku_builder/solver.rb">
378
+ <provider selected="true" editor-type-id="text-editor">
379
+ <state vertical-scroll-proportion="0.33333334" vertical-offset="0" max-vertical-offset="900">
380
+ <caret line="14" column="19" selection-start-line="14" selection-start-column="19" selection-end-line="14" selection-end-column="19" />
381
+ <folding />
382
+ </state>
383
+ </provider>
384
+ </entry>
385
+ <entry file="file://$PROJECT_DIR$/lib/sudoku_builder/builder.rb">
386
+ <provider selected="true" editor-type-id="text-editor">
387
+ <state vertical-scroll-proportion="0.1904762" vertical-offset="0" max-vertical-offset="1410">
388
+ <caret line="8" column="13" selection-start-line="8" selection-start-column="13" selection-end-line="8" selection-end-column="13" />
389
+ <folding />
390
+ </state>
391
+ </provider>
392
+ </entry>
393
+ <entry file="file://$PROJECT_DIR$/lib/sudoku_builder.rb">
394
+ <provider selected="true" editor-type-id="text-editor">
395
+ <state vertical-scroll-proportion="0.1904762" vertical-offset="0" max-vertical-offset="630">
396
+ <caret line="8" column="16" selection-start-line="8" selection-start-column="16" selection-end-line="8" selection-end-column="16" />
397
+ <folding />
398
+ </state>
399
+ </provider>
400
+ </entry>
401
+ </component>
402
+ </project>
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sudoku.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,17 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sudoku_builder (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (10.4.2)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ bundler (~> 1.9)
16
+ rake (~> 10.0)
17
+ sudoku_builder!
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Colin Walker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # Sudoku
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sudoku`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'sudoku'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install sudoku
22
+
23
+ ## Usage
24
+
25
+ To create a new puzzle:
26
+
27
+ `Sudoku.new`
28
+
29
+ This will return a `Sudoku::Builder` object that looks like this:
30
+
31
+ ```ruby
32
+ #<Sudoku::Builder:0x007fdc729373e8 @sud={0=>[6], 1=>[8], 2=>[9], 3=>[5], 4=>[7], 5=>[2], 6=>[3], ...
33
+ ```
34
+
35
+ On the builder object you can call a handful of different methods:
36
+
37
+ - `valid?` checks if the sudoku is valid.
38
+ - `to_hash` turns it into a regular hash.
39
+ - `poke(number, poke_with)` pokes holes in the puzzle. (to create a solvable sudoku)
40
+ - `medium`, `easy` and `hard` poke a set number of holes in the puzzle.
41
+ - `pretty_print` makes it print out nice on the command line.
42
+
43
+ To solve an existing puzzle, call:
44
+
45
+ `Sudoku::Solver.new(my_puzzle)`
46
+
47
+ 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
+
49
+ ```
50
+ {0=>6, 1=>8, 2=>[], 3=>[], 4=>[], 5=>[], 6=>[3] ...
51
+ ```
52
+
53
+ ## Development
54
+
55
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
56
+
57
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
58
+
59
+ ## Contributing
60
+
61
+ 1. Fork it ( https://github.com/[my-github-username]/sudoku/fork )
62
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
63
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
64
+ 4. Push to the branch (`git push origin my-new-feature`)
65
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sudoku_builder"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,89 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'sudoku'))
2
+
3
+ module SudokuBuilder
4
+ class Builder < SudokuBuilder
5
+ def initialize(sudoku)
6
+ @sud = sudoku
7
+ end
8
+
9
+ def parse
10
+ @sud.each do |k,v|
11
+ if v.class == Array && v[0] == nil
12
+ @sud[k] = []
13
+ elsif v.class == Array && v[0] != nil
14
+ @sud[k] = v[0]
15
+ else
16
+ @sud[k] = v
17
+ end
18
+ end
19
+ @sud
20
+ end
21
+
22
+ def to_hash
23
+ @sud.each do |k,v|
24
+ @sud[k] = v[0] if v.class == Array
25
+ end
26
+ @sud
27
+ end
28
+
29
+ # pokes holes in a built sudoku to make it solvable.
30
+ # arranged by level of difficulty.
31
+ def poke(number, poke_with = [])
32
+ @sud.to_hash
33
+ poke = []
34
+ until poke.count == number # number is related to difficulty.
35
+ poke << rand(0..80) # 0 - 80 refers to the index of the sudoku cells.
36
+ poke = poke.uniq
37
+ end
38
+ poke.each do |p| # pokes random holes.
39
+ @sud[p] = poke_with
40
+ end
41
+ Builder.new(@sud)
42
+ end
43
+
44
+ # checks if a sudoku is valid.
45
+ def valid?
46
+ valid = []
47
+ @sud.each do |k,v|
48
+ c = [] ; r = [] ; g = []
49
+ build_crg(k,c,r,g,@sud)
50
+ if check?(v[0], c,r,g) # runs the check method used before on every value.
51
+ valid << false
52
+ else
53
+ valid << true
54
+ end
55
+ end
56
+ !valid.include?(false)
57
+ end
58
+
59
+ def medium(poke_with = [])
60
+ self.poke(45, poke_with)
61
+ end
62
+
63
+ def easy(poke_with = [])
64
+ self.poke(55, poke_with)
65
+ end
66
+
67
+ def hard(poke_with = [])
68
+ self.poke(65, poke_with)
69
+ end
70
+
71
+ def pretty_print
72
+ b = self.to_hash
73
+ puts "+-----------------------------+"
74
+ puts "| #{b[0]} #{b[1]} #{b[2]} | #{b[3]} #{b[4]} #{b[5]} | #{b[6]} #{b[7]} #{b[8]} |"
75
+ puts "| #{b[9]} #{b[10]} #{b[11]} | #{b[12]} #{b[13]} #{b[14]} | #{b[15]} #{b[16]} #{b[17]} |"
76
+ puts "| #{b[18]} #{b[19]} #{b[20]} | #{b[21]} #{b[22]} #{b[23]} | #{b[24]} #{b[25]} #{b[26]} |"
77
+ puts "+-----------------------------+"
78
+ puts "| #{b[27]} #{b[28]} #{b[29]} | #{b[30]} #{b[31]} #{b[32]} | #{b[33]} #{b[34]} #{b[35]} |"
79
+ puts "| #{b[36]} #{b[37]} #{b[38]} | #{b[39]} #{b[40]} #{b[41]} | #{b[42]} #{b[43]} #{b[44]} |"
80
+ puts "| #{b[45]} #{b[46]} #{b[47]} | #{b[48]} #{b[49]} #{b[50]} | #{b[51]} #{b[52]} #{b[53]} |"
81
+ puts "+-----------------------------+"
82
+ puts "| #{b[54]} #{b[55]} #{b[56]} | #{b[57]} #{b[58]} #{b[59]} | #{b[60]} #{b[61]} #{b[62]} |"
83
+ puts "| #{b[63]} #{b[64]} #{b[65]} | #{b[66]} #{b[67]} #{b[68]} | #{b[69]} #{b[70]} #{b[71]} |"
84
+ puts "| #{b[72]} #{b[73]} #{b[74]} | #{b[75]} #{b[76]} #{b[77]} | #{b[78]} #{b[79]} #{b[80]} |"
85
+ puts "+-----------------------------+"
86
+ end
87
+
88
+ end
89
+ end
@@ -0,0 +1,54 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'sudoku'))
2
+ require File.expand_path(File.join(File.dirname(__FILE__), 'builder'))
3
+
4
+ module SudokuBuilder
5
+ class Solver < SudokuBuilder
6
+
7
+ def initialize(sudoku)
8
+ @sud = sudoku
9
+ @pristine = sudoku
10
+ @used = @sud.dup
11
+ end
12
+
13
+ # solve any given sudoku. If the sudoku is empty, it will build a complete one.
14
+ def solve
15
+ t = 0 ; o = 0
16
+ key = 0 # main key variable.
17
+ loop do
18
+ if @sud[key].class == Array # skips pre-filled numbers.
19
+ c = [] ; r = [] ; g = [] # build values for current grid, row, column.
20
+ build_crg(key,c,r,g,@sud) # updates the relevant variables for check.
21
+ @sud[key] = [] # makes a fresh possibilities array.
22
+ for i in 1..9
23
+ if check?(i, c,r,g) &&
24
+ !@used[key].include?(i) # checks for possible numbers.
25
+ @sud[key] << i
26
+ end
27
+ end
28
+ if @sud[key].count == 0 # backtrack if no possibilities.
29
+ key -= 1
30
+ else
31
+ use = @sud[key].sample # pick a random possibility.
32
+ @sud[key] = [use] # uses the possibility.
33
+ @used[key] << use # also puts it into the used array.
34
+ key += 1
35
+ end
36
+ if key == 0 || t > 104 # resets everything if we've reached a high amount
37
+ @sud.each { |k,v| @sud[k] = [] } # of run throughs, or the key has wound down to 0.
38
+ @used = @sud.dup
39
+ key = 0 ; t = 0
40
+ end
41
+ else
42
+ key += 1
43
+ end
44
+ break if key == 81 # break if we've reached the last value.
45
+ t += 1 ; o += 1 # add the reporting variables
46
+ break if o > 1000000 # there is the possibility to be given an
47
+ # unsolvable puzzle, this breaks if the number
48
+ # of run throughs is really really high.
49
+ end
50
+ Builder.new(@sud)
51
+ end
52
+
53
+ end
54
+ end
@@ -0,0 +1,30 @@
1
+ module SudokuBuilder
2
+ class Sudoku
3
+
4
+ # this method builds the 'c,r,g' arguments which are used as local variables within
5
+ # the main solve method to easily check whether a value is part of a row, column or
6
+ # grid. This is done by getting the keys of each item with matching row coordinates,
7
+ # column coordinates and grid coordinates, and adding all the values of each key to
8
+ # the c,r,g.
9
+ def build_crg(key,c,r,g,sud)
10
+ coord = {
11
+ 0=> [0,0,1], 1=> [1,0,1], 2=> [2,0,1], 3=> [3,0,4], 4=> [4,0,4], 5=> [5,0,4], 6=> [6,0,7], 7=> [7,0,7], 8=> [8,0,7],
12
+ 9=> [0,1,1], 10=>[1,1,1], 11=>[2,1,1], 12=>[3,1,4], 13=>[4,1,4], 14=>[5,1,4], 15=>[6,1,7], 16=>[7,1,7], 17=>[8,1,7],
13
+ 18=>[0,2,1], 19=>[1,2,1], 20=>[2,2,1], 21=>[3,2,4], 22=>[4,2,4], 23=>[5,2,4], 24=>[6,2,7], 25=>[7,2,7], 26=>[8,2,7],
14
+ 27=>[0,3,2], 28=>[1,3,2], 29=>[2,3,2], 30=>[3,3,5], 31=>[4,3,5], 32=>[5,3,5], 33=>[6,3,8], 34=>[7,3,8], 35=>[8,3,8],
15
+ 36=>[0,4,2], 37=>[1,4,2], 38=>[2,4,2], 39=>[3,4,5], 40=>[4,4,5], 41=>[5,4,5], 42=>[6,4,8], 43=>[7,4,8], 44=>[8,4,8],
16
+ 45=>[0,5,2], 46=>[1,5,2], 47=>[2,5,2], 48=>[3,5,5], 49=>[4,5,5], 50=>[5,5,5], 51=>[6,5,8], 52=>[7,5,8], 53=>[8,5,8],
17
+ 54=>[0,6,3], 55=>[1,6,3], 56=>[2,6,3], 57=>[3,6,6], 58=>[4,6,6], 59=>[5,6,6], 60=>[6,6,9], 61=>[7,6,9], 62=>[8,6,9],
18
+ 63=>[0,7,3], 64=>[1,7,3], 65=>[2,7,3], 66=>[3,7,6], 67=>[4,7,6], 68=>[5,7,6], 69=>[6,7,9], 70=>[7,7,9], 71=>[8,7,9],
19
+ 72=>[0,8,3], 73=>[1,8,3], 74=>[2,8,3], 75=>[3,8,6], 76=>[4,8,6], 77=>[5,8,6], 78=>[6,8,9], 79=>[7,8,9], 80=>[8,8,9]
20
+ }
21
+ coord.select { |k,v| v[0] == coord[key][0] }.keys.each { |k| c << sud[k] }
22
+ coord.select { |k,v| v[1] == coord[key][1] }.keys.each { |k| r << sud[k] }
23
+ coord.select { |k,v| v[2] == coord[key][2] }.keys.each { |k| g << sud[k] }
24
+ end
25
+
26
+ def check?(val,c,r,g)
27
+ !c.flatten.include?(val) && !r.flatten.include?(val) && !g.flatten.include?(val)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,3 @@
1
+ module SudokuBuilder
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'sudoku_builder/sudoku'))
2
+ require File.expand_path(File.join(File.dirname(__FILE__), 'sudoku_builder/builder'))
3
+ require File.expand_path(File.join(File.dirname(__FILE__), 'sudoku_builder/solver' ))
4
+ require File.expand_path(File.join(File.dirname(__FILE__), 'sudoku_builder/version'))
5
+
6
+ module SudokuBuilder
7
+ extend self
8
+ def new
9
+ sudoku = { }
10
+ q = 0
11
+ 81.times do
12
+ sudoku[q] = []
13
+ q += 1
14
+ end
15
+ Solver.new(sudoku).solve
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sudoku_builder/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sudoku_builder"
8
+ spec.version = SudokuBuilder::VERSION
9
+ spec.authors = ["Colin Walker"]
10
+ spec.email = ["cjwalker@sfu.ca"]
11
+
12
+ spec.summary = "Create a sudoku puzzle, and solve others with ease!"
13
+ spec.homepage = "https://github.com/ColDog/sudoku-gem"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.9"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sudoku_builder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Colin Walker
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-06-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description:
42
+ email:
43
+ - cjwalker@sfu.ca
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".idea/.name"
50
+ - ".idea/.rakeTasks"
51
+ - ".idea/encodings.xml"
52
+ - ".idea/misc.xml"
53
+ - ".idea/modules.xml"
54
+ - ".idea/scopes/scope_settings.xml"
55
+ - ".idea/sudoku.iml"
56
+ - ".idea/vcs.xml"
57
+ - ".idea/workspace.xml"
58
+ - ".rspec"
59
+ - ".travis.yml"
60
+ - Gemfile
61
+ - Gemfile.lock
62
+ - LICENSE
63
+ - README.md
64
+ - Rakefile
65
+ - bin/console
66
+ - bin/setup
67
+ - lib/sudoku_builder.rb
68
+ - lib/sudoku_builder/builder.rb
69
+ - lib/sudoku_builder/solver.rb
70
+ - lib/sudoku_builder/sudoku.rb
71
+ - lib/sudoku_builder/version.rb
72
+ - sudoku_builder.gemspec
73
+ homepage: https://github.com/ColDog/sudoku-gem
74
+ licenses: []
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.4.6
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Create a sudoku puzzle, and solve others with ease!
96
+ test_files: []