word_search 0.5.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.rubocop.yml +8 -5
- data/.ruby-version +1 -1
- data/.travis.yml +3 -2
- data/Gemfile +2 -1
- data/README.md +26 -4
- data/Rakefile +26 -12
- data/bin/console +5 -4
- data/bin/test +19 -0
- data/docs/Gemfile +8 -7
- data/docs/Gemfile.lock +31 -31
- data/docs/Rakefile +2 -1
- data/docs/config.rb +4 -3
- data/docs/source/images/logo.png +0 -0
- data/docs/source/images/search.png +0 -0
- data/docs/source/index.html.haml +49 -7
- data/docs/source/layouts/layout.html.haml +7 -9
- data/docs/source/stylesheets/site.css.sass +83 -0
- data/docs/vendor/cache/activesupport-5.0.1.gem +0 -0
- data/docs/vendor/cache/addressable-2.5.0.gem +0 -0
- data/docs/vendor/cache/backports-3.6.8.gem +0 -0
- data/docs/vendor/cache/coffee-script-2.4.1.gem +0 -0
- data/docs/vendor/cache/coffee-script-source-1.12.2.gem +0 -0
- data/docs/vendor/cache/compass-import-once-1.0.5.gem +0 -0
- data/docs/vendor/cache/concurrent-ruby-1.0.4.gem +0 -0
- data/docs/vendor/cache/contracts-0.13.0.gem +0 -0
- data/docs/vendor/cache/dotenv-2.1.1.gem +0 -0
- data/docs/vendor/cache/em-websocket-0.5.1.gem +0 -0
- data/docs/vendor/cache/erubis-2.7.0.gem +0 -0
- data/docs/vendor/cache/eventmachine-1.2.1.gem +0 -0
- data/docs/vendor/cache/execjs-2.7.0.gem +0 -0
- data/docs/vendor/cache/fast_blank-1.0.0.gem +0 -0
- data/docs/vendor/cache/fastimage-2.0.1.gem +0 -0
- data/docs/vendor/cache/ffi-1.9.14.gem +0 -0
- data/docs/vendor/cache/haml-4.0.7.gem +0 -0
- data/docs/vendor/cache/hamster-3.0.0.gem +0 -0
- data/docs/vendor/cache/hashie-3.4.6.gem +0 -0
- data/docs/vendor/cache/http_parser.rb-0.6.0.gem +0 -0
- data/docs/vendor/cache/i18n-0.7.0.gem +0 -0
- data/docs/vendor/cache/kramdown-1.13.2.gem +0 -0
- data/docs/vendor/cache/listen-3.0.8.gem +0 -0
- data/docs/vendor/cache/memoist-0.15.0.gem +0 -0
- data/docs/vendor/cache/middleman-4.2.0.gem +0 -0
- data/docs/vendor/cache/middleman-cli-4.2.0.gem +0 -0
- data/docs/vendor/cache/middleman-core-4.2.0.gem +0 -0
- data/docs/vendor/cache/middleman-gh-pages-0.3.1.gem +0 -0
- data/docs/vendor/cache/middleman-livereload-3.4.6.gem +0 -0
- data/docs/vendor/cache/minitest-5.10.1.gem +0 -0
- data/docs/vendor/cache/padrino-helpers-0.13.3.3.gem +0 -0
- data/docs/vendor/cache/padrino-support-0.13.3.3.gem +0 -0
- data/docs/vendor/cache/parallel-1.10.0.gem +0 -0
- data/docs/vendor/cache/public_suffix-2.0.5.gem +0 -0
- data/docs/vendor/cache/rack-2.0.1.gem +0 -0
- data/docs/vendor/cache/rack-livereload-0.3.16.gem +0 -0
- data/docs/vendor/cache/rake-12.0.0.gem +0 -0
- data/docs/vendor/cache/rb-fsevent-0.9.8.gem +0 -0
- data/docs/vendor/cache/rb-inotify-0.9.7.gem +0 -0
- data/docs/vendor/cache/sass-3.4.23.gem +0 -0
- data/docs/vendor/cache/servolux-0.12.0.gem +0 -0
- data/docs/vendor/cache/thor-0.19.4.gem +0 -0
- data/docs/vendor/cache/thread_safe-0.3.5.gem +0 -0
- data/docs/vendor/cache/tilt-2.0.5.gem +0 -0
- data/docs/vendor/cache/tzinfo-1.2.2.gem +0 -0
- data/docs/vendor/cache/uglifier-3.0.4.gem +0 -0
- data/lib/word_search.rb +25 -24
- data/lib/word_search/catalog.rb +1 -0
- data/lib/word_search/generator.rb +9 -3
- data/lib/word_search/generator/base.rb +50 -2
- data/lib/word_search/plane.rb +1 -0
- data/lib/word_search/plane/base.rb +25 -2
- data/lib/word_search/position_word/base.rb +32 -3
- data/lib/word_search/solver.rb +113 -3
- data/lib/word_search/three_dimensional/direction.rb +1 -0
- data/lib/word_search/three_dimensional/generator.rb +1 -18
- data/lib/word_search/three_dimensional/plane.rb +8 -1
- data/lib/word_search/three_dimensional/point.rb +5 -0
- data/lib/word_search/three_dimensional/position_word.rb +7 -0
- data/lib/word_search/two_dimensional/direction.rb +1 -0
- data/lib/word_search/two_dimensional/generator.rb +1 -18
- data/lib/word_search/two_dimensional/plane.rb +6 -1
- data/lib/word_search/two_dimensional/point.rb +5 -0
- data/lib/word_search/two_dimensional/position_word.rb +7 -0
- data/lib/word_search/version.rb +2 -1
- data/lib/word_search/word_bank.rb +4 -3
- data/vendor/cache/activemodel-5.0.1.gem +0 -0
- data/vendor/cache/activesupport-5.0.1.gem +0 -0
- data/vendor/cache/codeclimate-test-reporter-1.0.4.gem +0 -0
- data/vendor/cache/concurrent-ruby-1.0.4.gem +0 -0
- data/vendor/cache/metaclass-0.0.4.gem +0 -0
- data/vendor/cache/minitest-5.10.1.gem +0 -0
- data/vendor/cache/mocha-1.2.1.gem +0 -0
- data/vendor/cache/parser-2.3.3.1.gem +0 -0
- data/vendor/cache/rainbow-2.2.1.gem +0 -0
- data/vendor/cache/rake-12.0.0.gem +0 -0
- data/vendor/cache/rspec-core-3.5.4.gem +0 -0
- data/vendor/cache/rubocop-0.46.0.gem +0 -0
- data/vendor/cache/ruby-enum-0.6.0.gem +0 -0
- data/vendor/cache/unicode-display_width-1.1.2.gem +0 -0
- data/word_search.gemspec +23 -21
- metadata +91 -29
- data/docs/source/images/github-light.png +0 -0
- data/docs/source/images/github.png +0 -0
- data/docs/source/stylesheets/site.css.scss +0 -71
- data/lib/solution.rb +0 -67
- data/vendor/cache/activemodel-5.0.0.1.gem +0 -0
- data/vendor/cache/activesupport-5.0.0.1.gem +0 -0
- data/vendor/cache/codeclimate-test-reporter-0.6.0.gem +0 -0
- data/vendor/cache/concurrent-ruby-1.0.2.gem +0 -0
- data/vendor/cache/minitest-5.9.0.gem +0 -0
- data/vendor/cache/parser-2.3.1.2.gem +0 -0
- data/vendor/cache/rainbow-2.1.0.gem +0 -0
- data/vendor/cache/rake-10.5.0.gem +0 -0
- data/vendor/cache/rspec-core-3.5.2.gem +0 -0
- data/vendor/cache/rubocop-0.42.0.gem +0 -0
- data/vendor/cache/ruby-enum-0.5.0.gem +0 -0
- data/vendor/cache/unicode-display_width-1.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ab4c207882de6d2a510e22e640abbdf722623d6
|
4
|
+
data.tar.gz: 8ef6b1e8219ee91afd6b5e8539292fceafd5f3db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abbf179e39919da87e853702dad9b42c632ed38ed84af4da3247d21d5881f54255a334e08fcb27280b0f227ee28d60a3075f4620a8e62b40015d666bf60489aa
|
7
|
+
data.tar.gz: db8fad799ccb6361baf556f52282e1d777d3ddff12aa356dfb89fc577fac83b4d2c51f5678536b406a5fbc2c1dfdf4bd3279ac6974e61cd19a99acd4848687aa
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1043,6 +1043,7 @@ Style/SpecialGlobalVars:
|
|
1043
1043
|
Style/StringLiterals:
|
1044
1044
|
Description: 'Checks if uses of quotes match the configured preference.'
|
1045
1045
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
|
1046
|
+
EnforcedStyle: double_quotes
|
1046
1047
|
Enabled: true
|
1047
1048
|
|
1048
1049
|
Style/StringLiteralsInInterpolation:
|
@@ -1146,21 +1147,23 @@ Style/WhileUntilModifier:
|
|
1146
1147
|
Enabled: true
|
1147
1148
|
|
1148
1149
|
Style/MutableConstant:
|
1149
|
-
Enabled:
|
1150
|
+
Enabled: true
|
1150
1151
|
|
1151
1152
|
Style/FrozenStringLiteralComment:
|
1152
|
-
Enabled:
|
1153
|
+
Enabled: true
|
1153
1154
|
|
1154
1155
|
Style/WordArray:
|
1155
1156
|
Description: 'Use %w or %W for arrays of words.'
|
1156
1157
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
|
1157
1158
|
Enabled: true
|
1159
|
+
|
1160
|
+
Style/EmptyMethod:
|
1161
|
+
Enabled: false
|
1162
|
+
|
1158
1163
|
AllCops:
|
1159
1164
|
Exclude:
|
1160
1165
|
- 'vendor/**/*'
|
1161
|
-
- 'config/**/*'
|
1162
1166
|
- 'db/**/*'
|
1163
|
-
- 'bin/*'
|
1164
|
-
- 'Gemfile'
|
1165
1167
|
- 'Gemfile.lock'
|
1166
1168
|
- 'Rakefile'
|
1169
|
+
TargetRubyVersion: 2.3
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.3
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
## Install
|
8
8
|
Add WordSearch to your `Gemfile` and `bundle install`:
|
9
9
|
|
10
|
-
`gem
|
10
|
+
`gem "word_search"`
|
11
11
|
|
12
12
|
Alternatively, you can install the gem from [rubygems.org](https://rubygems.org/):
|
13
13
|
|
@@ -30,10 +30,10 @@ zqloh
|
|
30
30
|
muudd
|
31
31
|
himyj
|
32
32
|
|
33
|
-
# To print to a file(without a filename defaults to
|
33
|
+
# To print to a file(without a filename defaults to "word_search")
|
34
34
|
❯ plane.print(file_name)
|
35
35
|
|
36
|
-
# When printing a 3D
|
36
|
+
# When printing a 3D word search there are two spaces between z slices. The top slice is z = 0.
|
37
37
|
❯ plane = WordSearch::Plane.new(3, 3, 2)
|
38
38
|
❯ plane.add_letters
|
39
39
|
❯ plane.pto_s
|
@@ -48,7 +48,7 @@ utg
|
|
48
48
|
|
49
49
|
To create plane filled with words supplied by a word bank:
|
50
50
|
```ruby
|
51
|
-
❯ generator = WordSearch::Generator.new(
|
51
|
+
❯ generator = WordSearch::Generator.new("words.csv", 5, 5) # or add a z param to get a 3D word search
|
52
52
|
❯ generator.perform
|
53
53
|
❯ generator.word_bank
|
54
54
|
=> ["word", "hello", "bye"]
|
@@ -59,3 +59,25 @@ ylcon
|
|
59
59
|
blarz
|
60
60
|
yoydt
|
61
61
|
```
|
62
|
+
|
63
|
+
To solve or benchmark your solution script:
|
64
|
+
```ruby
|
65
|
+
❯ solver = WordSearch::Solver.new(
|
66
|
+
❯ "path/to/script", "path/to/word/bank", "path/to/word/search"
|
67
|
+
❯ )
|
68
|
+
❯ solver.perform
|
69
|
+
=> #<Benchmark::Tms:0x007fd722cc6b58 @cstime=0.07, @cutime=0.44, @label="", @real=0.5259899999946356, @stime=0.0, @total=0.51, @utime=0.0>
|
70
|
+
```
|
71
|
+
_NOTE_: Your script should be an executable ruby script that writes the location
|
72
|
+
of each letter to a file in the following format and returns the file path:
|
73
|
+
```
|
74
|
+
h [4, 9]
|
75
|
+
e [5, 9]
|
76
|
+
l [6, 9]
|
77
|
+
l [7, 9]
|
78
|
+
o [8, 9]
|
79
|
+
---
|
80
|
+
b [6, 8]
|
81
|
+
y [7, 7]
|
82
|
+
e [8, 6]
|
83
|
+
```
|
data/Rakefile
CHANGED
@@ -1,14 +1,28 @@
|
|
1
|
-
|
2
|
-
require
|
3
|
-
|
4
|
-
|
5
|
-
task :console do
|
6
|
-
require 'pry'
|
7
|
-
require 'word_searcher'
|
8
|
-
ARGV.clear
|
9
|
-
Pry.start
|
1
|
+
begin
|
2
|
+
require "bundler/setup"
|
3
|
+
rescue LoadError
|
4
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
10
5
|
end
|
11
6
|
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
require "rdoc/task"
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = "rdoc"
|
11
|
+
rdoc.title = "Chat"
|
12
|
+
rdoc.options << "--line-numbers"
|
13
|
+
rdoc.rdoc_files.include("README.md")
|
14
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
15
|
+
end
|
16
|
+
|
17
|
+
require "bundler/gem_tasks"
|
18
|
+
|
19
|
+
require "rake/testtask"
|
20
|
+
|
21
|
+
Rake::TestTask.new(:test) do |t|
|
22
|
+
t.libs << "lib"
|
23
|
+
t.libs << "test"
|
24
|
+
t.pattern = "test/**/*_test.rb"
|
25
|
+
t.verbose = false
|
26
|
+
end
|
27
|
+
|
28
|
+
task default: :test
|
data/bin/console
CHANGED
data/bin/test
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
require "pathname"
|
4
|
+
require "fileutils"
|
5
|
+
include FileUtils
|
6
|
+
|
7
|
+
# path to your application root.
|
8
|
+
APP_ROOT = Pathname.new File.expand_path("../../", __FILE__)
|
9
|
+
|
10
|
+
def system!(*args)
|
11
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
12
|
+
end
|
13
|
+
|
14
|
+
chdir APP_ROOT do
|
15
|
+
system! "rspec"
|
16
|
+
|
17
|
+
puts "\nChecking rubocop\n"
|
18
|
+
system! "bundle exec rubocop"
|
19
|
+
end
|
data/docs/Gemfile
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# If you do not have OpenSSL installed, change
|
2
3
|
# the following line to use 'http://'
|
3
|
-
source
|
4
|
+
source "https://rubygems.org"
|
4
5
|
|
5
6
|
# For faster file watcher updates on Windows:
|
6
|
-
gem
|
7
|
+
gem "wdm", "~> 0.1.0", platforms: [:mswin, :mingw]
|
7
8
|
|
8
9
|
# Windows does not come with time zone data
|
9
|
-
gem
|
10
|
+
gem "tzinfo-data", platforms: [:mswin, :mingw, :jruby]
|
10
11
|
|
11
12
|
# Middleman Gems
|
12
|
-
gem
|
13
|
-
gem
|
14
|
-
gem
|
13
|
+
gem "middleman", ">= 4.0.0"
|
14
|
+
gem "middleman-gh-pages"
|
15
|
+
gem "middleman-livereload"
|
15
16
|
|
16
|
-
gem
|
17
|
+
gem "haml"
|
data/docs/Gemfile.lock
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (
|
4
|
+
activesupport (5.0.1)
|
5
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
5
6
|
i18n (~> 0.7)
|
6
|
-
json (~> 1.7, >= 1.7.7)
|
7
7
|
minitest (~> 5.1)
|
8
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
9
8
|
tzinfo (~> 1.1)
|
10
|
-
addressable (2.
|
9
|
+
addressable (2.5.0)
|
10
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
11
11
|
backports (3.6.8)
|
12
12
|
coffee-script (2.4.1)
|
13
13
|
coffee-script-source
|
14
14
|
execjs
|
15
|
-
coffee-script-source (1.
|
15
|
+
coffee-script-source (1.12.2)
|
16
16
|
compass-import-once (1.0.5)
|
17
17
|
sass (>= 3.2, < 3.5)
|
18
|
-
concurrent-ruby (1.0.
|
18
|
+
concurrent-ruby (1.0.4)
|
19
19
|
contracts (0.13.0)
|
20
20
|
dotenv (2.1.1)
|
21
21
|
em-websocket (0.5.1)
|
22
22
|
eventmachine (>= 0.12.9)
|
23
23
|
http_parser.rb (~> 0.6.0)
|
24
24
|
erubis (2.7.0)
|
25
|
-
eventmachine (1.2.
|
25
|
+
eventmachine (1.2.1)
|
26
26
|
execjs (2.7.0)
|
27
27
|
fast_blank (1.0.0)
|
28
|
-
fastimage (2.0.
|
28
|
+
fastimage (2.0.1)
|
29
29
|
addressable (~> 2)
|
30
30
|
ffi (1.9.14)
|
31
31
|
haml (4.0.7)
|
@@ -35,24 +35,23 @@ GEM
|
|
35
35
|
hashie (3.4.6)
|
36
36
|
http_parser.rb (0.6.0)
|
37
37
|
i18n (0.7.0)
|
38
|
-
|
39
|
-
kramdown (1.12.0)
|
38
|
+
kramdown (1.13.2)
|
40
39
|
listen (3.0.8)
|
41
40
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
42
41
|
rb-inotify (~> 0.9, >= 0.9.7)
|
43
42
|
memoist (0.15.0)
|
44
|
-
middleman (4.
|
43
|
+
middleman (4.2.0)
|
45
44
|
coffee-script (~> 2.2)
|
46
45
|
compass-import-once (= 1.0.5)
|
47
46
|
haml (>= 4.0.5)
|
48
47
|
kramdown (~> 1.2)
|
49
|
-
middleman-cli (= 4.
|
50
|
-
middleman-core (= 4.
|
48
|
+
middleman-cli (= 4.2.0)
|
49
|
+
middleman-core (= 4.2.0)
|
51
50
|
sass (>= 3.4.0, < 4.0)
|
52
|
-
middleman-cli (4.
|
51
|
+
middleman-cli (4.2.0)
|
53
52
|
thor (>= 0.17.0, < 2.0)
|
54
|
-
middleman-core (4.
|
55
|
-
activesupport (
|
53
|
+
middleman-core (4.2.0)
|
54
|
+
activesupport (>= 4.2, < 5.1)
|
56
55
|
addressable (~> 2.3)
|
57
56
|
backports (~> 3.6)
|
58
57
|
bundler (~> 1.1)
|
@@ -69,10 +68,10 @@ GEM
|
|
69
68
|
memoist (~> 0.14)
|
70
69
|
padrino-helpers (~> 0.13.0)
|
71
70
|
parallel
|
72
|
-
rack (>= 1.4.5, <
|
71
|
+
rack (>= 1.4.5, < 3)
|
73
72
|
sass (>= 3.4)
|
74
73
|
servolux
|
75
|
-
tilt (~>
|
74
|
+
tilt (~> 2.0)
|
76
75
|
uglifier (~> 3.0)
|
77
76
|
middleman-gh-pages (0.3.1)
|
78
77
|
rake (> 0.9.3)
|
@@ -80,29 +79,30 @@ GEM
|
|
80
79
|
em-websocket (~> 0.5.1)
|
81
80
|
middleman-core (>= 3.3)
|
82
81
|
rack-livereload (~> 0.3.15)
|
83
|
-
minitest (5.
|
84
|
-
padrino-helpers (0.13.3.
|
82
|
+
minitest (5.10.1)
|
83
|
+
padrino-helpers (0.13.3.3)
|
85
84
|
i18n (~> 0.6, >= 0.6.7)
|
86
|
-
padrino-support (= 0.13.3.
|
85
|
+
padrino-support (= 0.13.3.3)
|
87
86
|
tilt (>= 1.4.1, < 3)
|
88
|
-
padrino-support (0.13.3.
|
87
|
+
padrino-support (0.13.3.3)
|
89
88
|
activesupport (>= 3.1)
|
90
|
-
parallel (1.
|
91
|
-
|
89
|
+
parallel (1.10.0)
|
90
|
+
public_suffix (2.0.5)
|
91
|
+
rack (2.0.1)
|
92
92
|
rack-livereload (0.3.16)
|
93
93
|
rack
|
94
|
-
rake (
|
95
|
-
rb-fsevent (0.9.
|
94
|
+
rake (12.0.0)
|
95
|
+
rb-fsevent (0.9.8)
|
96
96
|
rb-inotify (0.9.7)
|
97
97
|
ffi (>= 0.5.0)
|
98
|
-
sass (3.4.
|
98
|
+
sass (3.4.23)
|
99
99
|
servolux (0.12.0)
|
100
|
-
thor (0.19.
|
100
|
+
thor (0.19.4)
|
101
101
|
thread_safe (0.3.5)
|
102
|
-
tilt (
|
102
|
+
tilt (2.0.5)
|
103
103
|
tzinfo (1.2.2)
|
104
104
|
thread_safe (~> 0.1)
|
105
|
-
uglifier (3.0.
|
105
|
+
uglifier (3.0.4)
|
106
106
|
execjs (>= 0.3.0, < 3)
|
107
107
|
|
108
108
|
PLATFORMS
|
@@ -117,4 +117,4 @@ DEPENDENCIES
|
|
117
117
|
wdm (~> 0.1.0)
|
118
118
|
|
119
119
|
BUNDLED WITH
|
120
|
-
1.
|
120
|
+
1.13.7
|
data/docs/Rakefile
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "middleman-gh-pages"
|
data/docs/config.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
###
|
2
3
|
# Page options, layouts, aliases and proxies
|
3
4
|
###
|
@@ -5,9 +6,9 @@
|
|
5
6
|
# Per-page layout changes:
|
6
7
|
#
|
7
8
|
# With no layout
|
8
|
-
page
|
9
|
-
page
|
10
|
-
page
|
9
|
+
page "/*.xml", layout: false
|
10
|
+
page "/*.json", layout: false
|
11
|
+
page "/*.txt", layout: false
|
11
12
|
|
12
13
|
# With alternative layout
|
13
14
|
# page "/path/to/file.html", layout: :otherlayout
|
Binary file
|
Binary file
|
data/docs/source/index.html.haml
CHANGED
@@ -5,7 +5,7 @@ title: Word Search Gem
|
|
5
5
|
.fork
|
6
6
|
.block
|
7
7
|
= link_to "https://github.com/npezza93/word_search" do
|
8
|
-
.github
|
8
|
+
%i.fa.fa-github
|
9
9
|
Fork on GitHub
|
10
10
|
|
11
11
|
.container
|
@@ -22,9 +22,9 @@ title: Word Search Gem
|
|
22
22
|
Add word_search to your Gemfile and bundle install:
|
23
23
|
%pre
|
24
24
|
%code
|
25
|
-
gem
|
26
|
-
|
27
|
-
|
25
|
+
gem "word_search"
|
26
|
+
%p
|
27
|
+
Alternatively, you can install the gem from rubygems.org and require it in your script:
|
28
28
|
%pre
|
29
29
|
%code
|
30
30
|
gem install word_search
|
@@ -39,10 +39,10 @@ title: Word Search Gem
|
|
39
39
|
%pre
|
40
40
|
%code
|
41
41
|
:preserve
|
42
|
-
require
|
42
|
+
require "word_search"
|
43
43
|
|
44
44
|
# You can also add another param, z, to get a 3D word search
|
45
|
-
generator = WordSearch::Generator.new(
|
45
|
+
generator = WordSearch::Generator.new("words.csv", 5, 5)
|
46
46
|
# Calling #perform will place the words and fill the empty spots
|
47
47
|
# with random letters
|
48
48
|
generator.perform
|
@@ -60,7 +60,7 @@ title: Word Search Gem
|
|
60
60
|
%pre
|
61
61
|
%code
|
62
62
|
:preserve
|
63
|
-
require
|
63
|
+
require "word_search"
|
64
64
|
|
65
65
|
plane = WordSearch::Plane.make_from_file("word_search")
|
66
66
|
# To find the max of x or y
|
@@ -84,3 +84,45 @@ title: Word Search Gem
|
|
84
84
|
zqloh
|
85
85
|
muudd
|
86
86
|
himyj
|
87
|
+
|
88
|
+
%br
|
89
|
+
%br
|
90
|
+
|
91
|
+
%h3
|
92
|
+
Solver
|
93
|
+
%p
|
94
|
+
You can benchmark and check if your solution works by using the Solver class.
|
95
|
+
Your script should be an executable ruby script that writes the location
|
96
|
+
of each letter to a file in the following format and returns the file path.
|
97
|
+
%pre
|
98
|
+
:preserve
|
99
|
+
h [4, 9]
|
100
|
+
e [5, 9]
|
101
|
+
l [6, 9]
|
102
|
+
l [7, 9]
|
103
|
+
o [8, 9]
|
104
|
+
---
|
105
|
+
b [6, 8]
|
106
|
+
y [7, 7]
|
107
|
+
e [8, 6]
|
108
|
+
%pre
|
109
|
+
%code
|
110
|
+
:preserve
|
111
|
+
require "word_search"
|
112
|
+
|
113
|
+
plane = WordSearch::Solver.new(
|
114
|
+
"path/to/script", "path/to/word/bank", "path/to/word/search"
|
115
|
+
)
|
116
|
+
solver.perform
|
117
|
+
=> Benchmark::Tms:0x007fd722cc6b58 @cstime=0.07,
|
118
|
+
@cutime=0.44, @label="", @real=0.5259899999946356,
|
119
|
+
@stime=0.0, @total=0.51, @utime=0.0
|
120
|
+
# If your script fails or is incorrect a message will appear instead
|
121
|
+
# of the benchmark.
|
122
|
+
|
123
|
+
#np_logo_container
|
124
|
+
= link_to "https://github.com/npezza93", class: "social-container" do
|
125
|
+
%i.fa.fa-github
|
126
|
+
= image_tag "logo.png", id: "np_logo"
|
127
|
+
= link_to "https://www.linkedin.com/in/nick-pezza-02166668", class: "social-container" do
|
128
|
+
%i.fa.fa-linkedin
|