letter_press_is_not_as_good_as_boggle 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +6 -4
- data/data/screenshot.jpg +0 -0
- data/example.rb +5 -17
- data/lib/letter_press_is_not_as_good_as_boggle.rb +5 -4
- data/lib/letter_press_is_not_as_good_as_boggle/version.rb +1 -1
- data/spec/acceptance_spec.rb +5 -5
- metadata +7 -6
data/Readme.md
CHANGED
@@ -2,8 +2,10 @@ LetterPressIsNotAsGoodAsBoggle
|
|
2
2
|
==============================
|
3
3
|
|
4
4
|
There's this game called LetterPress, it's sort of like Boggle, but less awesome.
|
5
|
-
|
6
|
-
|
5
|
+
But that doesn't mean that _you_ can't be awesome!
|
6
|
+
|
7
|
+
![screenshot](https://raw.github.com/JoshCheek/letter_press_is_not_as_good_as_boggle/master/data/screenshot.jpg)
|
8
|
+
|
7
9
|
|
8
10
|
Install
|
9
11
|
=======
|
@@ -23,7 +25,7 @@ LetterPressIsNotAsGoodAsBoggle do
|
|
23
25
|
x z u g o
|
24
26
|
b i o g f]
|
25
27
|
|
26
|
-
|
28
|
+
guessed %w[groupie
|
27
29
|
hogger]
|
28
30
|
|
29
31
|
# get the list of all known words that can be made on the board
|
@@ -35,7 +37,7 @@ end
|
|
35
37
|
WTF Public License
|
36
38
|
==================
|
37
39
|
|
38
|
-
WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
40
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
39
41
|
Version 2, December 2004
|
40
42
|
|
41
43
|
Copyright (C) 2012 Josh Cheek <josh.cheek@gmail.com>
|
data/data/screenshot.jpg
ADDED
Binary file
|
data/example.rb
CHANGED
@@ -1,28 +1,16 @@
|
|
1
1
|
require 'letter_press_is_not_as_good_as_boggle'
|
2
2
|
|
3
3
|
words = LetterPressIsNotAsGoodAsBoggle do
|
4
|
-
board %w[o
|
5
|
-
s e m x k
|
6
|
-
z i s v s
|
7
|
-
w e a v o
|
8
|
-
d d f k a]
|
4
|
+
board %w[n x g k o e e s i s v a j f e m l r g f z i a j b]
|
9
5
|
|
10
|
-
|
11
|
-
mocked
|
12
|
-
disavowed
|
13
|
-
kiddies
|
14
|
-
mocked
|
15
|
-
miscoded
|
16
|
-
wifes
|
17
|
-
coveys
|
18
|
-
amazed
|
19
|
-
admixes]
|
6
|
+
guessed %w[averages vagaries lovemaking maligners remixing reimagines generalissimo fragile]
|
20
7
|
end
|
21
8
|
|
22
9
|
def score(word, targets)
|
23
10
|
(targets - word.chars.to_a).size
|
24
11
|
end
|
25
12
|
|
26
|
-
|
27
|
-
|
13
|
+
preferred_chars = %w[g f]
|
14
|
+
|
15
|
+
words.sort_by { |word| [-score(word, preferred_chars), word.size] }
|
28
16
|
.each { |word| puts word }
|
@@ -13,7 +13,7 @@ class LetterPressIsNotAsGoodAsBoggle
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def initialize(all_words=LetterPressIsNotAsGoodAsBoggle.all_words, &definition)
|
16
|
-
@
|
16
|
+
@guessed = []
|
17
17
|
self.searcher = WordList::Searcher.new WordList.new all_words
|
18
18
|
instance_eval &definition
|
19
19
|
end
|
@@ -22,9 +22,10 @@ class LetterPressIsNotAsGoodAsBoggle
|
|
22
22
|
self.chars = chars
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
@
|
25
|
+
def guessed(guessed=[])
|
26
|
+
@guessed = guessed
|
27
27
|
end
|
28
|
+
alias guesses guessed # to maintain backwards compatibility
|
28
29
|
|
29
30
|
def words
|
30
31
|
@words ||= begin
|
@@ -32,7 +33,7 @@ class LetterPressIsNotAsGoodAsBoggle
|
|
32
33
|
board_traverser.each_with_recur do |word, char, recurser|
|
33
34
|
next unless searcher.has_child? char
|
34
35
|
searcher.down_to char do
|
35
|
-
words << word if searcher.on_word? && !@
|
36
|
+
words << word if searcher.on_word? && !@guessed.include?(word)
|
36
37
|
recurser.call
|
37
38
|
end
|
38
39
|
end
|
data/spec/acceptance_spec.rb
CHANGED
@@ -2,14 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe LetterPressIsNotAsGoodAsBoggle do
|
4
4
|
specify 'words are returned sorted by length asc and do not include duplicates or previous guesses' do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
all_words
|
5
|
+
unguessed_words = %w[abc ab dac]
|
6
|
+
guessed_words = %w[adc dab]
|
7
|
+
nonmatching_words = %w[x nek]
|
8
|
+
all_words = unguessed_words + guessed_words + nonmatching_words
|
9
9
|
|
10
10
|
letter_press = LetterPressIsNotAsGoodAsBoggle.new all_words do
|
11
11
|
board %w[a b c d a]
|
12
|
-
|
12
|
+
guessed guessed_words
|
13
13
|
end
|
14
14
|
|
15
15
|
letter_press.words.should == %w[ab abc dac]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: letter_press_is_not_as_good_as_boggle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70349710586500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.4'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70349710586500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: simplecov
|
27
|
-
requirement: &
|
27
|
+
requirement: &70349710586000 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 0.7.1
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70349710586000
|
36
36
|
description: Find all known words for a letterpress board (iPhone 5 game that is like
|
37
37
|
boggle, but worse)
|
38
38
|
email:
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- .gitignore
|
45
45
|
- Gemfile
|
46
46
|
- Readme.md
|
47
|
+
- data/screenshot.jpg
|
47
48
|
- data/word_list
|
48
49
|
- example.rb
|
49
50
|
- letter_press_is_not_as_good_as_boggle.gemspec
|