waylon-wordle 0.1.2 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2596ef4ec8693e71cfb5403ce693bbda6ea655b251e6e26323400ba2519fe6d8
4
- data.tar.gz: 42dc06d83b8413e42c9593d4c1910ed867ec53318d0de63533c13b990f83b057
3
+ metadata.gz: 6db7ed70378421cf71a537df618751aaeb7ce1bf203248dbc9bb480acabc5d67
4
+ data.tar.gz: 8413894c357ff8c94c4e30a1cb0ef23f0f3c2ec3f4b481413674aed3a8324b70
5
5
  SHA512:
6
- metadata.gz: 48b6a455d30619785d1720b2d0c97b5c0dbb62758c4f4e0e9f158e01a5baedcfeccef6e76e3a5141814fc441d412cd734acb8b9863c04348942aa003eaf5ee63
7
- data.tar.gz: 6977cf0a5de54f7044e4f4698ad60557bd9f035c4454a9e5a4945347a96248b445d0ed98c46a287ccf332f7cb18fc2acddf8c019f72920182d1f64cc062e52c4
6
+ metadata.gz: a3b47236b1eec73f56138ca62f85be4f68cbf302555321374dd4128f563aa6c08d8ccd104730cca2b18ff556e0114cf6ac9e7ea0e66c47f4daf394f70b2a57b8
7
+ data.tar.gz: e827295dc9c1599243ebf462b649ba00c5b32d67ec45ea7764967abb1b3e4f74c4b7c435fc2bc98511baa9bd23e0093046c52988b422c4f255b1e2bcf1159409
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waylon-wordle (0.1.2)
4
+ waylon-wordle (0.2.0)
5
5
  waylon-core (~> 0.1)
6
6
 
7
7
  GEM
data/Rakefile CHANGED
@@ -10,3 +10,12 @@ require "rubocop/rake_task"
10
10
  RuboCop::RakeTask.new
11
11
 
12
12
  task default: %i[spec rubocop]
13
+
14
+ task :demo do
15
+ require "waylon/core"
16
+ require "waylon/wordle"
17
+ Waylon::Logger.logger = ::Logger.new("/dev/null")
18
+ Waylon::Cache.storage = Moneta.new(:Cookie)
19
+ Waylon::Storage.storage = Moneta.new(:Cookie)
20
+ require "waylon/rspec/test_server"
21
+ end
@@ -14,7 +14,8 @@ module Waylon
14
14
  answer = Waylon::Wordle.for_today.chars
15
15
  attempts = [startword.chars]
16
16
  attempts << make_attempt(answer, attempts) until attempts.last == answer || attempts.size == 6
17
- attempts
17
+
18
+ attempts.compact
18
19
  end
19
20
 
20
21
  def make_attempt(answer, attempts)
@@ -22,11 +23,11 @@ module Waylon
22
23
  near_hits = []
23
24
  misses = []
24
25
 
25
- attempts.each do |attempt|
26
+ attempts.compact.each do |attempt|
26
27
  attempt.each_with_index do |letter, index|
27
28
  if letter == answer[index]
28
29
  hits[index] = letter
29
- elsif answer.include?(letter)
30
+ elsif answer.include?(letter) && hits.count(letter) < answer.count(letter)
30
31
  near_hits[index] ||= []
31
32
  near_hits[index] << letter
32
33
  else
@@ -53,7 +54,7 @@ module Waylon
53
54
  next unless letters && !letters.empty?
54
55
 
55
56
  return false if letters.include?(exploded_word[index])
56
- return false unless exploded_word.intersect?(letters)
57
+ return false unless (letters - exploded_word).empty?
57
58
  end
58
59
 
59
60
  true
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Waylon
4
4
  module Wordle
5
- VERSION = "0.1.2"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waylon-wordle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy