wordl-solver 0.2.6 → 0.2.51
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/wordl_solver.rb +3 -14
- data/wordl-solver.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27cd3bdd02312caa90f00eb5c19a0bb9fcf3ba5ed3cee60a1decf90553549f9d
|
4
|
+
data.tar.gz: b9882733e0ca569e86499135ea4d318133aede200b855a646d4a1fd8abdead02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4227cb660e43740fbcf488e6627d34c22cb8f216e89314502ecb0151dfdf1eef2fcc12df3c3c339c277d5e88cbaaa3316ccf9a17e6700608e2100fbbd6ced6bd
|
7
|
+
data.tar.gz: 071b8c33e798867483147f2b4016b74e26f84a3595389101dc2f459ca454392ea78ee2cd9acc9bc6ecfff4c84265d5ffd3fd943ca4ae842c6109cd7250795de2
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.51
|
data/lib/wordl_solver.rb
CHANGED
@@ -6,6 +6,7 @@ require 'fileutils'
|
|
6
6
|
FILE_PATH = File.join(File.dirname(__FILE__), '5_words.csv')
|
7
7
|
|
8
8
|
LETTER_WORDS = []
|
9
|
+
LETTER_FRENQUENCY = %w[e t a o i n s h r d l c u m f w y g p b v k j x q z].reverse.freeze
|
9
10
|
|
10
11
|
CSV.foreach(FILE_PATH) do |row|
|
11
12
|
LETTER_WORDS << row[0]
|
@@ -79,7 +80,6 @@ class WordlSolver
|
|
79
80
|
end
|
80
81
|
|
81
82
|
def find_possible_words
|
82
|
-
@possible_words = @possible_words.empty? ? LETTER_WORDS : @possible_words
|
83
83
|
filter_greens
|
84
84
|
filter_yellows
|
85
85
|
filter_greys
|
@@ -88,11 +88,10 @@ class WordlSolver
|
|
88
88
|
def present_possible_words
|
89
89
|
puts 'here are the existing words'
|
90
90
|
hash_word_frequency = {}
|
91
|
-
set_letters_frequencies
|
92
91
|
@possible_words.each do |word|
|
93
92
|
count = 0
|
94
93
|
word.chars.uniq.each do |char|
|
95
|
-
count +=
|
94
|
+
count += LETTER_FRENQUENCY.index(char)
|
96
95
|
end
|
97
96
|
hash_word_frequency[word] = count
|
98
97
|
end
|
@@ -103,7 +102,7 @@ class WordlSolver
|
|
103
102
|
end
|
104
103
|
|
105
104
|
def filter_greens
|
106
|
-
@possible_words.select
|
105
|
+
@possible_words = (@possible_words.empty? ? LETTER_WORDS : @possible_words).select do |word|
|
107
106
|
put_in = true
|
108
107
|
@greens.each do |key, value|
|
109
108
|
next if value.nil?
|
@@ -135,14 +134,4 @@ class WordlSolver
|
|
135
134
|
def check_word_correct(letters)
|
136
135
|
letters.length != 2 || !%w[s y g].include?(letters[0])
|
137
136
|
end
|
138
|
-
|
139
|
-
def set_letters_frequencies
|
140
|
-
@frenquencies = {}
|
141
|
-
@possible_words.each do |word|
|
142
|
-
word.chars.each do |letter|
|
143
|
-
@frenquencies[letter] = 0 if @frenquencies[letter].nil?
|
144
|
-
@frenquencies[letter] += 1
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
137
|
end
|
data/wordl-solver.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: wordl-solver 0.2.
|
5
|
+
# stub: wordl-solver 0.2.51 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "wordl-solver".freeze
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.51"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["george kosmopoulos".freeze]
|
14
|
-
s.date = "2022-
|
14
|
+
s.date = "2022-04-29"
|
15
15
|
s.description = "This gem helps you solve wordl puzzles. It does so by asking you for the letters position you know, the letters you know exists and the ones you know don't exists. It then proposes words depending on how good they are by weighting the letters by their frequency in the english language.".freeze
|
16
16
|
s.email = "gkosmo1@hotmail.com".freeze
|
17
17
|
s.executables = ["wordl-solver".freeze]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordl-solver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.51
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- george kosmopoulos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shoulda
|