wordle_decoder 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f99c89b38bbf201f3cc823ce9cb134d952b2b58a9fd0832f92bfab41e63bd01
4
- data.tar.gz: bcd052c478b24f5e0b5d360007688f04edd0c5fd47c8870f426759168fe4cc97
3
+ metadata.gz: 1b287c675238c8e02b76dd2fcb7c6811837831e2245954a9465a2f1d6634ecb5
4
+ data.tar.gz: 1d0f11cdd67b6443ebc6362daf666e82006c361b23a9847ee8c1a3020eeea1ad
5
5
  SHA512:
6
- metadata.gz: 9641a6f0cce9a39b9b137a72ef8e7fc9cf0cb310ca658c2182cfe9aa3c8c66916ccacfcd76ea57236c8fd3b7e25182b9833433453f25acadbd31e35f4ca1a037
7
- data.tar.gz: 6f39d15f60434b8a88a30c018b9860198c3d7080566a937cabd0d2d152232e599fb10e7b0a85969e405651c67c8cc65a681fcd0c5eaaf248d7aef1f58b075cd5
6
+ metadata.gz: 4dcdc6aa0b31fd576fc973bd35ff7681ae4e054009d62f81afa00a25088e06e81e4c128068de5c524d4e30668b49bd0847e2354f5f614e80fab0e48a7c56c75d
7
+ data.tar.gz: d414927380ff8e1832c7eb70b1e9f632dc41357d586f1f9674cda5f8161e0d6e2c3ff393677b45fab47155d2b56dac1f6edf4a446003da4b4b2fdbf2399af6aa
data/.rubocop.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 2.6
3
+ NewCops: enable
3
4
 
4
5
  Style/StringLiterals:
5
6
  Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.4] - 2022-03-06
4
+
5
+ - Deal with weird input chars - https://github.com/mattruzicka/wordle_decoder/issues/2
6
+
3
7
  ## [0.1.3] - 2022-03-05
4
8
 
5
9
  - Support shortcode emojis - https://github.com/mattruzicka/wordle_decoder/pull/1
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ task default: %i[test rubocop]
20
20
  task :create_word_search_files do
21
21
  sorted_words = load_words_sorted_by_frequency
22
22
  most_common_words = sorted_words.pop(3_000)
23
- most_common_words, less_common_words = most_common_words.partition { |r| r.split("").uniq.count == 5 }
23
+ most_common_words, less_common_words = most_common_words.partition { |r| r.chars.uniq.count == 5 }
24
24
  File.write(lib_path("most_common_words.txt"), most_common_words.join("\n"))
25
25
  File.write(lib_path("less_common_words.txt"), less_common_words.join("\n"))
26
26
  File.write(lib_path("least_common_words.txt"), sorted_words.join("\n"))
@@ -29,7 +29,7 @@ end
29
29
  task :output_most_common_letters do
30
30
  words = load_wordle_words("allowed_answers.txt")
31
31
  words.concat load_wordle_words("allowed_guesses.txt")
32
- letter_count_tally = words.flat_map { _1.split("") }.tally
32
+ letter_count_tally = words.flat_map { _1.chars }.tally
33
33
  letter_count_tally = letter_count_tally.sort_by { -_2 }
34
34
  puts letter_count_tally.first(10).map { _1.first }.join(" ")
35
35
  end
data/bin/wordle_decoder CHANGED
@@ -139,4 +139,4 @@ salutations = ["Maybe some of those are your words!",
139
139
  "I enjoyed our time together!"].freeze
140
140
 
141
141
  puts CLI::UI.fmt("\n\n #{salutations.sample}\n " \
142
- "{{blue:https://github.com/mattruzicka/wordle_decoder}}}}\n\n")
142
+ "{{blue:https://github.com/mattruzicka/wordle_decoder}}}}\n\n")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class WordleDecoder
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
@@ -23,7 +23,7 @@ class WordleDecoder
23
23
  end
24
24
 
25
25
  def chars
26
- @chars ||= @word_str.split("")
26
+ @chars ||= @word_str.chars
27
27
  end
28
28
 
29
29
  COMMON_LETTERS = %w[s e a o r i l t n].freeze
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
3
+ require "json"
4
4
 
5
5
  class WordleDecoder
6
6
  class WordSearch
@@ -62,7 +62,7 @@ class WordleDecoder
62
62
  end
63
63
 
64
64
  def answer_chars
65
- @answer_chars ||= answer&.strip&.split("")
65
+ @answer_chars ||= answer&.strip&.chars
66
66
  end
67
67
 
68
68
  def hint_lines
@@ -102,11 +102,16 @@ class WordleDecoder
102
102
 
103
103
  def parse_wordle_lines!
104
104
  input_lines.filter_map do |line|
105
- line = translate_emoji_shortcodes(line)
105
+ line = normalize_wordle_line(line)
106
106
  line if line.each_char.all? { |c| VALID_HINT_CHARS.include?(c) }
107
107
  end
108
108
  end
109
109
 
110
+ def normalize_wordle_line(line)
111
+ line = translate_emoji_shortcodes(line)
112
+ line.each_grapheme_cluster.map { |cluster| cluster.codepoints.first }.pack("U*")
113
+ end
114
+
110
115
  SHORTCODES_TO_EMOJIS = { ":black_large_square:" => "⬛",
111
116
  ":white_large_square:" => "⬜",
112
117
  ":large_green_square:" => "🟩",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordle_decoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Ruzicka
@@ -59,6 +59,7 @@ licenses:
59
59
  metadata:
60
60
  homepage_uri: https://github.com/mattruzicka/wordle_decoder
61
61
  source_code_uri: https://github.com/mattruzicka/wordle_decoder
62
+ rubygems_mfa_required: 'true'
62
63
  post_install_message:
63
64
  rdoc_options: []
64
65
  require_paths: