word_search 0.5.0 → 0.5.1
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 +4 -4
- data/.gitignore +2 -0
- data/docs/Gemfile +16 -0
- data/docs/Gemfile.lock +120 -0
- data/docs/Rakefile +1 -0
- data/docs/config.rb +47 -0
- data/docs/source/images/github-light.png +0 -0
- data/docs/source/images/github.png +0 -0
- data/docs/source/index.html.haml +86 -0
- data/docs/source/javascripts/all.js +1 -0
- data/docs/source/layouts/layout.html.haml +20 -0
- data/docs/source/stylesheets/_normalize.scss +419 -0
- data/docs/source/stylesheets/site.css.scss +71 -0
- data/lib/solution.rb +5 -5
- data/lib/word_search/generator/base.rb +1 -1
- data/lib/word_search/plane/base.rb +1 -3
- data/lib/word_search/three_dimensional/plane.rb +4 -0
- data/lib/word_search/two_dimensional/plane.rb +4 -0
- data/lib/word_search/version.rb +1 -1
- metadata +13 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77f4e1d1505ddcae37cdfacdd41906a8315f3da9
|
|
4
|
+
data.tar.gz: 23b157e475059758bd1ca08eff8faee31ced31b6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7189d7726bcc25a675e29ceef9b6c9ae9746948d368c7cb6ed3c84d45099e09540b53af967b9fa4ab3b123099a73eb22427130fc5a8f8fa97c2b7776cac1bd6e
|
|
7
|
+
data.tar.gz: cd104a514e60a429979ad0b5e6a32b0330bab253c664de2cdd14515716c101f3026e0387441e0c3ecf517ef3f54013ef9f5679e4d02481ee922024daeced4dd3
|
data/.gitignore
CHANGED
data/docs/Gemfile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# If you do not have OpenSSL installed, change
|
|
2
|
+
# the following line to use 'http://'
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
|
+
|
|
5
|
+
# For faster file watcher updates on Windows:
|
|
6
|
+
gem 'wdm', '~> 0.1.0', platforms: [:mswin, :mingw]
|
|
7
|
+
|
|
8
|
+
# Windows does not come with time zone data
|
|
9
|
+
gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby]
|
|
10
|
+
|
|
11
|
+
# Middleman Gems
|
|
12
|
+
gem 'middleman', '>= 4.0.0'
|
|
13
|
+
gem 'middleman-livereload'
|
|
14
|
+
gem 'middleman-gh-pages'
|
|
15
|
+
|
|
16
|
+
gem 'haml'
|
data/docs/Gemfile.lock
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
activesupport (4.2.7.1)
|
|
5
|
+
i18n (~> 0.7)
|
|
6
|
+
json (~> 1.7, >= 1.7.7)
|
|
7
|
+
minitest (~> 5.1)
|
|
8
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
|
9
|
+
tzinfo (~> 1.1)
|
|
10
|
+
addressable (2.4.0)
|
|
11
|
+
backports (3.6.8)
|
|
12
|
+
coffee-script (2.4.1)
|
|
13
|
+
coffee-script-source
|
|
14
|
+
execjs
|
|
15
|
+
coffee-script-source (1.10.0)
|
|
16
|
+
compass-import-once (1.0.5)
|
|
17
|
+
sass (>= 3.2, < 3.5)
|
|
18
|
+
concurrent-ruby (1.0.2)
|
|
19
|
+
contracts (0.13.0)
|
|
20
|
+
dotenv (2.1.1)
|
|
21
|
+
em-websocket (0.5.1)
|
|
22
|
+
eventmachine (>= 0.12.9)
|
|
23
|
+
http_parser.rb (~> 0.6.0)
|
|
24
|
+
erubis (2.7.0)
|
|
25
|
+
eventmachine (1.2.0.1)
|
|
26
|
+
execjs (2.7.0)
|
|
27
|
+
fast_blank (1.0.0)
|
|
28
|
+
fastimage (2.0.0)
|
|
29
|
+
addressable (~> 2)
|
|
30
|
+
ffi (1.9.14)
|
|
31
|
+
haml (4.0.7)
|
|
32
|
+
tilt
|
|
33
|
+
hamster (3.0.0)
|
|
34
|
+
concurrent-ruby (~> 1.0)
|
|
35
|
+
hashie (3.4.6)
|
|
36
|
+
http_parser.rb (0.6.0)
|
|
37
|
+
i18n (0.7.0)
|
|
38
|
+
json (1.8.3)
|
|
39
|
+
kramdown (1.12.0)
|
|
40
|
+
listen (3.0.8)
|
|
41
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
42
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
|
43
|
+
memoist (0.15.0)
|
|
44
|
+
middleman (4.1.10)
|
|
45
|
+
coffee-script (~> 2.2)
|
|
46
|
+
compass-import-once (= 1.0.5)
|
|
47
|
+
haml (>= 4.0.5)
|
|
48
|
+
kramdown (~> 1.2)
|
|
49
|
+
middleman-cli (= 4.1.10)
|
|
50
|
+
middleman-core (= 4.1.10)
|
|
51
|
+
sass (>= 3.4.0, < 4.0)
|
|
52
|
+
middleman-cli (4.1.10)
|
|
53
|
+
thor (>= 0.17.0, < 2.0)
|
|
54
|
+
middleman-core (4.1.10)
|
|
55
|
+
activesupport (~> 4.2)
|
|
56
|
+
addressable (~> 2.3)
|
|
57
|
+
backports (~> 3.6)
|
|
58
|
+
bundler (~> 1.1)
|
|
59
|
+
contracts (~> 0.13.0)
|
|
60
|
+
dotenv
|
|
61
|
+
erubis
|
|
62
|
+
execjs (~> 2.0)
|
|
63
|
+
fast_blank
|
|
64
|
+
fastimage (~> 2.0)
|
|
65
|
+
hamster (~> 3.0)
|
|
66
|
+
hashie (~> 3.4)
|
|
67
|
+
i18n (~> 0.7.0)
|
|
68
|
+
listen (~> 3.0.0)
|
|
69
|
+
memoist (~> 0.14)
|
|
70
|
+
padrino-helpers (~> 0.13.0)
|
|
71
|
+
parallel
|
|
72
|
+
rack (>= 1.4.5, < 2.0)
|
|
73
|
+
sass (>= 3.4)
|
|
74
|
+
servolux
|
|
75
|
+
tilt (~> 1.4.1)
|
|
76
|
+
uglifier (~> 3.0)
|
|
77
|
+
middleman-gh-pages (0.3.1)
|
|
78
|
+
rake (> 0.9.3)
|
|
79
|
+
middleman-livereload (3.4.6)
|
|
80
|
+
em-websocket (~> 0.5.1)
|
|
81
|
+
middleman-core (>= 3.3)
|
|
82
|
+
rack-livereload (~> 0.3.15)
|
|
83
|
+
minitest (5.9.1)
|
|
84
|
+
padrino-helpers (0.13.3.2)
|
|
85
|
+
i18n (~> 0.6, >= 0.6.7)
|
|
86
|
+
padrino-support (= 0.13.3.2)
|
|
87
|
+
tilt (>= 1.4.1, < 3)
|
|
88
|
+
padrino-support (0.13.3.2)
|
|
89
|
+
activesupport (>= 3.1)
|
|
90
|
+
parallel (1.9.0)
|
|
91
|
+
rack (1.6.4)
|
|
92
|
+
rack-livereload (0.3.16)
|
|
93
|
+
rack
|
|
94
|
+
rake (11.3.0)
|
|
95
|
+
rb-fsevent (0.9.7)
|
|
96
|
+
rb-inotify (0.9.7)
|
|
97
|
+
ffi (>= 0.5.0)
|
|
98
|
+
sass (3.4.22)
|
|
99
|
+
servolux (0.12.0)
|
|
100
|
+
thor (0.19.1)
|
|
101
|
+
thread_safe (0.3.5)
|
|
102
|
+
tilt (1.4.1)
|
|
103
|
+
tzinfo (1.2.2)
|
|
104
|
+
thread_safe (~> 0.1)
|
|
105
|
+
uglifier (3.0.2)
|
|
106
|
+
execjs (>= 0.3.0, < 3)
|
|
107
|
+
|
|
108
|
+
PLATFORMS
|
|
109
|
+
ruby
|
|
110
|
+
|
|
111
|
+
DEPENDENCIES
|
|
112
|
+
haml
|
|
113
|
+
middleman (>= 4.0.0)
|
|
114
|
+
middleman-gh-pages
|
|
115
|
+
middleman-livereload
|
|
116
|
+
tzinfo-data
|
|
117
|
+
wdm (~> 0.1.0)
|
|
118
|
+
|
|
119
|
+
BUNDLED WITH
|
|
120
|
+
1.12.5
|
data/docs/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'middleman-gh-pages'
|
data/docs/config.rb
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
###
|
|
2
|
+
# Page options, layouts, aliases and proxies
|
|
3
|
+
###
|
|
4
|
+
|
|
5
|
+
# Per-page layout changes:
|
|
6
|
+
#
|
|
7
|
+
# With no layout
|
|
8
|
+
page '/*.xml', layout: false
|
|
9
|
+
page '/*.json', layout: false
|
|
10
|
+
page '/*.txt', layout: false
|
|
11
|
+
|
|
12
|
+
# With alternative layout
|
|
13
|
+
# page "/path/to/file.html", layout: :otherlayout
|
|
14
|
+
|
|
15
|
+
# Proxy pages (http://middlemanapp.com/basics/dynamic-pages/)
|
|
16
|
+
# proxy "/this-page-has-no-template.html", "/template-file.html", locals: {
|
|
17
|
+
# which_fake_page: "Rendering a fake page with a local variable" }
|
|
18
|
+
|
|
19
|
+
# General configuration
|
|
20
|
+
|
|
21
|
+
# Reload the browser automatically whenever files change
|
|
22
|
+
configure :development do
|
|
23
|
+
activate :livereload
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
activate :relative_assets
|
|
27
|
+
set :relative_links, true
|
|
28
|
+
|
|
29
|
+
###
|
|
30
|
+
# Helpers
|
|
31
|
+
###
|
|
32
|
+
|
|
33
|
+
# Methods defined in the helpers block are available in templates
|
|
34
|
+
# helpers do
|
|
35
|
+
# def some_helper
|
|
36
|
+
# "Helping"
|
|
37
|
+
# end
|
|
38
|
+
# end
|
|
39
|
+
|
|
40
|
+
# Build-specific configuration
|
|
41
|
+
configure :build do
|
|
42
|
+
# Minify CSS on build
|
|
43
|
+
# activate :minify_css
|
|
44
|
+
|
|
45
|
+
# Minify Javascript on build
|
|
46
|
+
# activate :minify_javascript
|
|
47
|
+
end
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Word Search Gem
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
.fork
|
|
6
|
+
.block
|
|
7
|
+
= link_to "https://github.com/npezza93/word_search" do
|
|
8
|
+
.github-icon
|
|
9
|
+
Fork on GitHub
|
|
10
|
+
|
|
11
|
+
.container
|
|
12
|
+
%h1.center Word Search
|
|
13
|
+
%h4.center
|
|
14
|
+
Easily create a 2D and 3D word searches of any size given a csv of words
|
|
15
|
+
|
|
16
|
+
%br
|
|
17
|
+
%br
|
|
18
|
+
|
|
19
|
+
%h3
|
|
20
|
+
Install
|
|
21
|
+
%p
|
|
22
|
+
Add word_search to your Gemfile and bundle install:
|
|
23
|
+
%pre
|
|
24
|
+
%code
|
|
25
|
+
gem 'word_search'
|
|
26
|
+
|
|
27
|
+
Alternatively, you can install the gem from rubygems.org and require it in your script:
|
|
28
|
+
%pre
|
|
29
|
+
%code
|
|
30
|
+
gem install word_search
|
|
31
|
+
|
|
32
|
+
%br
|
|
33
|
+
%br
|
|
34
|
+
|
|
35
|
+
%h3
|
|
36
|
+
Quick Start
|
|
37
|
+
%p
|
|
38
|
+
Using the supplied Generator class you can be up and running in a couple lines:
|
|
39
|
+
%pre
|
|
40
|
+
%code
|
|
41
|
+
:preserve
|
|
42
|
+
require 'word_search'
|
|
43
|
+
|
|
44
|
+
# You can also add another param, z, to get a 3D word search
|
|
45
|
+
generator = WordSearch::Generator.new('words.csv', 5, 5)
|
|
46
|
+
# Calling #perform will place the words and fill the empty spots
|
|
47
|
+
# with random letters
|
|
48
|
+
generator.perform
|
|
49
|
+
# Call #print to write the word search to a file
|
|
50
|
+
generator.print("word_search")
|
|
51
|
+
|
|
52
|
+
%br
|
|
53
|
+
%br
|
|
54
|
+
|
|
55
|
+
%h3
|
|
56
|
+
Plane
|
|
57
|
+
%p
|
|
58
|
+
You can load up a word search from a file and have access to a couple
|
|
59
|
+
helpful utilites
|
|
60
|
+
%pre
|
|
61
|
+
%code
|
|
62
|
+
:preserve
|
|
63
|
+
require 'word_search'
|
|
64
|
+
|
|
65
|
+
plane = WordSearch::Plane.make_from_file("word_search")
|
|
66
|
+
# To find the max of x or y
|
|
67
|
+
plane.x
|
|
68
|
+
=> 5
|
|
69
|
+
plane.y
|
|
70
|
+
=> 5
|
|
71
|
+
# When a plane is generated, all positions by letter are
|
|
72
|
+
# cataloged into a hash for quick searching.
|
|
73
|
+
plane.catalog
|
|
74
|
+
=> {"j"=> [Point @letter="j", @x=0, @y=0>],
|
|
75
|
+
"r"=> [Point @letter="r", @x=1, @y=0>]}
|
|
76
|
+
# To get all possible traversable directions around a point
|
|
77
|
+
plane.directions.to_h
|
|
78
|
+
=> { N: [0, 1], NE: [1, 1], E: [1, 0], SE: [1, -1], S: [0, -1],
|
|
79
|
+
SW: [-1, -1], W: [-1, 0], NW: [-1, 1] }
|
|
80
|
+
# To print the plane to the screen
|
|
81
|
+
plane.pto_s
|
|
82
|
+
nvqgy
|
|
83
|
+
uhsit
|
|
84
|
+
zqloh
|
|
85
|
+
muudd
|
|
86
|
+
himyj
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hljs.initHighlightingOnLoad();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
!!!
|
|
2
|
+
%html
|
|
3
|
+
%head
|
|
4
|
+
%meta{content: "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
|
|
5
|
+
%meta{content: "IE=edge", "http-equiv" => "X-UA-Compatible"}/
|
|
6
|
+
%meta{:charset => "utf-8"}/
|
|
7
|
+
%meta{content: "width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no", :name => "viewport"}/
|
|
8
|
+
|
|
9
|
+
%script{:src => "//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js"}
|
|
10
|
+
%link{:href => "//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/styles/atom-one-dark.min.css", :rel => "stylesheet"}/
|
|
11
|
+
|
|
12
|
+
%title= current_page.data.title || "Middleman"
|
|
13
|
+
%link{:href => "//fonts.googleapis.com/css?family=Lato:300,400", :rel => "stylesheet", :type => "text/css"}/
|
|
14
|
+
%link{:href => "//fonts.googleapis.com/css?family=Droid+Sans+Mono", :rel => "stylesheet", :type => "text/css"}/
|
|
15
|
+
|
|
16
|
+
= stylesheet_link_tag :site
|
|
17
|
+
= javascript_include_tag :all
|
|
18
|
+
|
|
19
|
+
%body{:class => page_classes}
|
|
20
|
+
= yield
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 1. Change the default font family in all browsers (opinionated).
|
|
5
|
+
* 2. Prevent adjustments of font size after orientation changes in IE and iOS.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
html {
|
|
9
|
+
font-family: sans-serif; /* 1 */
|
|
10
|
+
-ms-text-size-adjust: 100%; /* 2 */
|
|
11
|
+
-webkit-text-size-adjust: 100%; /* 2 */
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Remove the margin in all browsers (opinionated).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
body {
|
|
19
|
+
margin: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* HTML5 display definitions
|
|
23
|
+
========================================================================== */
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Add the correct display in IE 9-.
|
|
27
|
+
* 1. Add the correct display in Edge, IE, and Firefox.
|
|
28
|
+
* 2. Add the correct display in IE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
article,
|
|
32
|
+
aside,
|
|
33
|
+
details, /* 1 */
|
|
34
|
+
figcaption,
|
|
35
|
+
figure,
|
|
36
|
+
footer,
|
|
37
|
+
header,
|
|
38
|
+
main, /* 2 */
|
|
39
|
+
menu,
|
|
40
|
+
nav,
|
|
41
|
+
section,
|
|
42
|
+
summary { /* 1 */
|
|
43
|
+
display: block;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Add the correct display in IE 9-.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
audio,
|
|
51
|
+
canvas,
|
|
52
|
+
progress,
|
|
53
|
+
video {
|
|
54
|
+
display: inline-block;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Add the correct display in iOS 4-7.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
audio:not([controls]) {
|
|
62
|
+
display: none;
|
|
63
|
+
height: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
progress {
|
|
71
|
+
vertical-align: baseline;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Add the correct display in IE 10-.
|
|
76
|
+
* 1. Add the correct display in IE.
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
template, /* 1 */
|
|
80
|
+
[hidden] {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Links
|
|
85
|
+
========================================================================== */
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 1. Remove the gray background on active links in IE 10.
|
|
89
|
+
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
a {
|
|
93
|
+
background-color: transparent; /* 1 */
|
|
94
|
+
-webkit-text-decoration-skip: objects; /* 2 */
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Remove the outline on focused links when they are also active or hovered
|
|
99
|
+
* in all browsers (opinionated).
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
a:active,
|
|
103
|
+
a:hover {
|
|
104
|
+
outline-width: 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Text-level semantics
|
|
108
|
+
========================================================================== */
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 1. Remove the bottom border in Firefox 39-.
|
|
112
|
+
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
abbr[title] {
|
|
116
|
+
border-bottom: none; /* 1 */
|
|
117
|
+
text-decoration: underline; /* 2 */
|
|
118
|
+
text-decoration: underline dotted; /* 2 */
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
b,
|
|
126
|
+
strong {
|
|
127
|
+
font-weight: inherit;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Add the correct font weight in Chrome, Edge, and Safari.
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
b,
|
|
135
|
+
strong {
|
|
136
|
+
font-weight: bolder;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Add the correct font style in Android 4.3-.
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
dfn {
|
|
144
|
+
font-style: italic;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Correct the font size and margin on `h1` elements within `section` and
|
|
149
|
+
* `article` contexts in Chrome, Firefox, and Safari.
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
h1 {
|
|
153
|
+
font-size: 2em;
|
|
154
|
+
margin: 0.67em 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Add the correct background and color in IE 9-.
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
mark {
|
|
162
|
+
background-color: #ff0;
|
|
163
|
+
color: #000;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Add the correct font size in all browsers.
|
|
168
|
+
*/
|
|
169
|
+
|
|
170
|
+
small {
|
|
171
|
+
font-size: 80%;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Prevent `sub` and `sup` elements from affecting the line height in
|
|
176
|
+
* all browsers.
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
sub,
|
|
180
|
+
sup {
|
|
181
|
+
font-size: 75%;
|
|
182
|
+
line-height: 0;
|
|
183
|
+
position: relative;
|
|
184
|
+
vertical-align: baseline;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
sub {
|
|
188
|
+
bottom: -0.25em;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
sup {
|
|
192
|
+
top: -0.5em;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* Embedded content
|
|
196
|
+
========================================================================== */
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Remove the border on images inside links in IE 10-.
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
img {
|
|
203
|
+
border-style: none;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Hide the overflow in IE.
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
svg:not(:root) {
|
|
211
|
+
overflow: hidden;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* Grouping content
|
|
215
|
+
========================================================================== */
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* 1. Correct the inheritance and scaling of font size in all browsers.
|
|
219
|
+
* 2. Correct the odd `em` font sizing in all browsers.
|
|
220
|
+
*/
|
|
221
|
+
|
|
222
|
+
code,
|
|
223
|
+
kbd,
|
|
224
|
+
pre,
|
|
225
|
+
samp {
|
|
226
|
+
font-family: monospace, monospace; /* 1 */
|
|
227
|
+
font-size: 1em; /* 2 */
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Add the correct margin in IE 8.
|
|
232
|
+
*/
|
|
233
|
+
|
|
234
|
+
figure {
|
|
235
|
+
margin: 1em 40px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* 1. Add the correct box sizing in Firefox.
|
|
240
|
+
* 2. Show the overflow in Edge and IE.
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
hr {
|
|
244
|
+
box-sizing: content-box; /* 1 */
|
|
245
|
+
height: 0; /* 1 */
|
|
246
|
+
overflow: visible; /* 2 */
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* Forms
|
|
250
|
+
========================================================================== */
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* 1. Change font properties to `inherit` in all browsers (opinionated).
|
|
254
|
+
* 2. Remove the margin in Firefox and Safari.
|
|
255
|
+
*/
|
|
256
|
+
|
|
257
|
+
button,
|
|
258
|
+
input,
|
|
259
|
+
select,
|
|
260
|
+
textarea {
|
|
261
|
+
font: inherit; /* 1 */
|
|
262
|
+
margin: 0; /* 2 */
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Restore the font weight unset by the previous rule.
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
optgroup {
|
|
270
|
+
font-weight: bold;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Show the overflow in IE.
|
|
275
|
+
* 1. Show the overflow in Edge.
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
button,
|
|
279
|
+
input { /* 1 */
|
|
280
|
+
overflow: visible;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Remove the inheritance of text transform in Edge, Firefox, and IE.
|
|
285
|
+
* 1. Remove the inheritance of text transform in Firefox.
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
button,
|
|
289
|
+
select { /* 1 */
|
|
290
|
+
text-transform: none;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
|
|
295
|
+
* controls in Android 4.
|
|
296
|
+
* 2. Correct the inability to style clickable types in iOS and Safari.
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
button,
|
|
300
|
+
html [type="button"], /* 1 */
|
|
301
|
+
[type="reset"],
|
|
302
|
+
[type="submit"] {
|
|
303
|
+
-webkit-appearance: button; /* 2 */
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Remove the inner border and padding in Firefox.
|
|
308
|
+
*/
|
|
309
|
+
|
|
310
|
+
button::-moz-focus-inner,
|
|
311
|
+
[type="button"]::-moz-focus-inner,
|
|
312
|
+
[type="reset"]::-moz-focus-inner,
|
|
313
|
+
[type="submit"]::-moz-focus-inner {
|
|
314
|
+
border-style: none;
|
|
315
|
+
padding: 0;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Restore the focus styles unset by the previous rule.
|
|
320
|
+
*/
|
|
321
|
+
|
|
322
|
+
button:-moz-focusring,
|
|
323
|
+
[type="button"]:-moz-focusring,
|
|
324
|
+
[type="reset"]:-moz-focusring,
|
|
325
|
+
[type="submit"]:-moz-focusring {
|
|
326
|
+
outline: 1px dotted ButtonText;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Change the border, margin, and padding in all browsers (opinionated).
|
|
331
|
+
*/
|
|
332
|
+
|
|
333
|
+
fieldset {
|
|
334
|
+
border: 1px solid #c0c0c0;
|
|
335
|
+
margin: 0 2px;
|
|
336
|
+
padding: 0.35em 0.625em 0.75em;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* 1. Correct the text wrapping in Edge and IE.
|
|
341
|
+
* 2. Correct the color inheritance from `fieldset` elements in IE.
|
|
342
|
+
* 3. Remove the padding so developers are not caught out when they zero out
|
|
343
|
+
* `fieldset` elements in all browsers.
|
|
344
|
+
*/
|
|
345
|
+
|
|
346
|
+
legend {
|
|
347
|
+
box-sizing: border-box; /* 1 */
|
|
348
|
+
color: inherit; /* 2 */
|
|
349
|
+
display: table; /* 1 */
|
|
350
|
+
max-width: 100%; /* 1 */
|
|
351
|
+
padding: 0; /* 3 */
|
|
352
|
+
white-space: normal; /* 1 */
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Remove the default vertical scrollbar in IE.
|
|
357
|
+
*/
|
|
358
|
+
|
|
359
|
+
textarea {
|
|
360
|
+
overflow: auto;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* 1. Add the correct box sizing in IE 10-.
|
|
365
|
+
* 2. Remove the padding in IE 10-.
|
|
366
|
+
*/
|
|
367
|
+
|
|
368
|
+
[type="checkbox"],
|
|
369
|
+
[type="radio"] {
|
|
370
|
+
box-sizing: border-box; /* 1 */
|
|
371
|
+
padding: 0; /* 2 */
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Correct the cursor style of increment and decrement buttons in Chrome.
|
|
376
|
+
*/
|
|
377
|
+
|
|
378
|
+
[type="number"]::-webkit-inner-spin-button,
|
|
379
|
+
[type="number"]::-webkit-outer-spin-button {
|
|
380
|
+
height: auto;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* 1. Correct the odd appearance in Chrome and Safari.
|
|
385
|
+
* 2. Correct the outline style in Safari.
|
|
386
|
+
*/
|
|
387
|
+
|
|
388
|
+
[type="search"] {
|
|
389
|
+
-webkit-appearance: textfield; /* 1 */
|
|
390
|
+
outline-offset: -2px; /* 2 */
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Remove the inner padding and cancel buttons in Chrome and Safari on OS X.
|
|
395
|
+
*/
|
|
396
|
+
|
|
397
|
+
[type="search"]::-webkit-search-cancel-button,
|
|
398
|
+
[type="search"]::-webkit-search-decoration {
|
|
399
|
+
-webkit-appearance: none;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Correct the text style of placeholders in Chrome, Edge, and Safari.
|
|
404
|
+
*/
|
|
405
|
+
|
|
406
|
+
::-webkit-input-placeholder {
|
|
407
|
+
color: inherit;
|
|
408
|
+
opacity: 0.54;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* 1. Correct the inability to style clickable types in iOS and Safari.
|
|
413
|
+
* 2. Change font properties to `inherit` in Safari.
|
|
414
|
+
*/
|
|
415
|
+
|
|
416
|
+
::-webkit-file-upload-button {
|
|
417
|
+
-webkit-appearance: button; /* 1 */
|
|
418
|
+
font: inherit; /* 2 */
|
|
419
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
@charset "utf-8";
|
|
2
|
+
@import "normalize";
|
|
3
|
+
|
|
4
|
+
body {
|
|
5
|
+
background: #4DD0E1;
|
|
6
|
+
font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
h1 {
|
|
10
|
+
color: rgba(0,0,0,0.5);
|
|
11
|
+
font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
12
|
+
font-size: 3.5em;
|
|
13
|
+
font-weight: 400;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 20px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.container {
|
|
19
|
+
width: 700px;
|
|
20
|
+
max-width: 90%;
|
|
21
|
+
margin: auto;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.hljs {
|
|
25
|
+
padding: 20px;
|
|
26
|
+
font-family: 'Droid Sans Mono', monospace;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.center {
|
|
30
|
+
text-align: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.fork .block {
|
|
34
|
+
justify-content: flex-end;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
|
|
38
|
+
a {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: row;
|
|
41
|
+
align-items: center;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
margin: 7px;
|
|
44
|
+
margin-right: 13px;
|
|
45
|
+
border: 2px solid rgba(0,0,0,0.5);
|
|
46
|
+
padding: 10px;
|
|
47
|
+
color: rgba(0,0,0,0.5);
|
|
48
|
+
background: transparent;
|
|
49
|
+
transition: all 0.5s ease;
|
|
50
|
+
text-decoration: none;
|
|
51
|
+
|
|
52
|
+
.github-icon {
|
|
53
|
+
background-image: url('../images/github.png');
|
|
54
|
+
width: 25px;
|
|
55
|
+
height: 25px;
|
|
56
|
+
background-repeat: no-repeat;
|
|
57
|
+
background-size: contain;
|
|
58
|
+
margin-right: 10px;
|
|
59
|
+
transition: all 0.5s ease;
|
|
60
|
+
}
|
|
61
|
+
&:hover {
|
|
62
|
+
background-color: rgba(0,0,0,0.5);
|
|
63
|
+
color: #fff;
|
|
64
|
+
border: 2px solid rgba(0, 0, 0, 0.0);
|
|
65
|
+
|
|
66
|
+
.github-icon {
|
|
67
|
+
background-image: url('../images/github-light.png');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
data/lib/solution.rb
CHANGED
|
@@ -14,7 +14,7 @@ class Solution
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def plane
|
|
17
|
-
@plane ||= WordSearch::Plane.make_from_file('
|
|
17
|
+
@plane ||= WordSearch::Plane.make_from_file('word_search')
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def word_bank
|
|
@@ -35,8 +35,8 @@ class Solution
|
|
|
35
35
|
def find_word(word)
|
|
36
36
|
plane.catalog[word[0]].find do |point|
|
|
37
37
|
directions.find do |direction|
|
|
38
|
-
next if (spot = find_point(point, word.size - 1, direction)).blank?
|
|
39
|
-
|
|
38
|
+
next if (spot = find_point(point, word.size - 1, direction)).blank? ||
|
|
39
|
+
not_found?(spot, word, point, direction)
|
|
40
40
|
|
|
41
41
|
@solved[word] = { first: point, last: spot}
|
|
42
42
|
spot
|
|
@@ -44,8 +44,8 @@ class Solution
|
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
def
|
|
48
|
-
spot.letter
|
|
47
|
+
def not_found?(spot, word, point, direction)
|
|
48
|
+
!(spot.letter == word[-1] && double_check(word, point, direction))
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def find_point(point, move, direction)
|
|
@@ -8,9 +8,7 @@ module WordSearch
|
|
|
8
8
|
validates :x, :y, numericality: { greater_than_or_equal_to: 2 }
|
|
9
9
|
|
|
10
10
|
def print(file_name = nil)
|
|
11
|
-
|
|
12
|
-
file.write(to_s)
|
|
13
|
-
file
|
|
11
|
+
File.open(file_name || 'word_search', 'w') { |f| f.write to_s }
|
|
14
12
|
end
|
|
15
13
|
|
|
16
14
|
def random_letter
|
data/lib/word_search/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: word_search
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- npezza93
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -170,6 +170,17 @@ files:
|
|
|
170
170
|
- bin/console
|
|
171
171
|
- bin/coverage
|
|
172
172
|
- bin/setup
|
|
173
|
+
- docs/Gemfile
|
|
174
|
+
- docs/Gemfile.lock
|
|
175
|
+
- docs/Rakefile
|
|
176
|
+
- docs/config.rb
|
|
177
|
+
- docs/source/images/github-light.png
|
|
178
|
+
- docs/source/images/github.png
|
|
179
|
+
- docs/source/index.html.haml
|
|
180
|
+
- docs/source/javascripts/all.js
|
|
181
|
+
- docs/source/layouts/layout.html.haml
|
|
182
|
+
- docs/source/stylesheets/_normalize.scss
|
|
183
|
+
- docs/source/stylesheets/site.css.scss
|
|
173
184
|
- lib/solution.rb
|
|
174
185
|
- lib/word_search.rb
|
|
175
186
|
- lib/word_search/catalog.rb
|