waylon-wordle 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,9 +43,11 @@ module Waylon
43
43
  def find_potential_solution
44
44
  potential_solutions = Waylon::Wordle.vocabulary.map(&:chars).reject { _1.intersect?(misses) }
45
45
 
46
- potential_solutions.select do |word|
46
+ candidates = potential_solutions.select do |word|
47
47
  hits_match?(hits, word) && near_hits_match?(near_hits, word)
48
- end.sample
48
+ end
49
+
50
+ candidates.shuffle.max_by { _1.uniq.size }
49
51
  end
50
52
 
51
53
  def last_attempted_word = attempts.last[:word]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Waylon
4
4
  module Wordle
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.1"
6
6
  end
7
7
  end
data/lib/waylon/wordle.rb CHANGED
@@ -29,7 +29,13 @@ module Waylon
29
29
  end
30
30
 
31
31
  def self.random_startword
32
- vocabulary.select { |word| word.chars.intersection(%w[a e i o u]).uniq.size >= 3 }.sample
32
+ vocabulary.select do |word|
33
+ if rand(10) > 5
34
+ word.chars.uniq.intersection(%w[a e i o u]).uniq.size >= 4
35
+ else
36
+ word.chars.uniq.intersection(%w[a e o s t r n]).uniq.size >= 4
37
+ end
38
+ end.sample
33
39
  end
34
40
 
35
41
  def self.todays_date
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waylon-wordle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-02 00:00:00.000000000 Z
11
+ date: 2023-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: waylon-core