wordle_decoder 0.1.2 → 0.1.3

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: dca5b9fbafa87be192d4a5768b878564412854bdb8838e1e9ac55d1eb0244d4a
4
- data.tar.gz: b9ec7358da606b398da0f653fc62d4ac2c8f697fc91f6a43dcf478c77a7f68d2
3
+ metadata.gz: 7f99c89b38bbf201f3cc823ce9cb134d952b2b58a9fd0832f92bfab41e63bd01
4
+ data.tar.gz: bcd052c478b24f5e0b5d360007688f04edd0c5fd47c8870f426759168fe4cc97
5
5
  SHA512:
6
- metadata.gz: d2fb07120f3c105302ae4b251cd3f7df6a80be4ca5aadc81cae29410bf63137024c277c3c862337b4b10bf7e4bda9ad8901626f01de27309e9e189d8a22a172b
7
- data.tar.gz: 9f21c02dc2d567e2e613482181ffe0a24b6d5e8b567f99333e76cc346d161dd67376c69a8615afc611754467da375380fd4282094e68cb452610afe8d568eff2
6
+ metadata.gz: 9641a6f0cce9a39b9b137a72ef8e7fc9cf0cb310ca658c2182cfe9aa3c8c66916ccacfcd76ea57236c8fd3b7e25182b9833433453f25acadbd31e35f4ca1a037
7
+ data.tar.gz: 6f39d15f60434b8a88a30c018b9860198c3d7080566a937cabd0d2d152232e599fb10e7b0a85969e405651c67c8cc65a681fcd0c5eaaf248d7aef1f58b075cd5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.0] - 2022-02-22
3
+ ## [0.1.3] - 2022-03-05
4
4
 
5
- - Initial release
5
+ - Support shortcode emojis - https://github.com/mattruzicka/wordle_decoder/pull/1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wordle_decoder (0.1.0)
4
+ wordle_decoder (0.1.3)
5
5
  cli-ui (~> 1.5)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,19 +1,36 @@
1
1
  # Wordle Decoder
2
2
 
3
- It guesses your guesses based on all those little 🟨, 🟩, and ⬛ emojis that we now love to share.
3
+ It guesses your guesses based on all those little square emojis that we now love to share.
4
4
 
5
- Given your Wordle share text, with some degree of confidence, the decoder will spit back the five-letter words it thinks you played.
5
+ Given your Wordle share, the decoder will spit back the five-letter words it thinks you played with some degree of confidence.
6
6
 
7
7
  ## Installation
8
8
 
9
+ Have Ruby 2.7 or later installed, then run the following at the command line:
10
+
9
11
  $ gem install wordle_decoder
10
12
 
11
13
  ## Usage
12
14
 
13
- After entering the below at the command line, you should be prompted to enter your Wordle share and the Wordle word of the day.
15
+ After installing the gem, run `wordle_decoder` at the command line like so:
14
16
 
15
17
  $ wordle_decoder
16
18
 
17
- ## Examples
19
+ You'll be prompted to share your wordle. Go ahead and paste in your wordle share text. The share text should look something like this:
20
+
21
+ ```
22
+ Wordle 258 3/6
23
+
24
+ ⬛⬛🟨⬛🟨
25
+ ⬛🟩🟩🟩⬛
26
+ 🟩🟩🟩🟩🟩
27
+ ```
28
+ You'll then be prompted to confirm the word of the day, or if it couldn't figure it out, you'll be asked for it. After that, it'll _try_ to guess your guesses.
29
+
30
+ ## Why?
31
+
32
+ I wasn't sure if something like this was possible and thought it'd be a fun project to build. It does a pretty good job, at least some of the time... I built an excuse to play Wordle.
33
+
34
+ Enjoy,
18
35
 
19
- TODO...
36
+ [@mattruzicka](https://twitter.com/mattruzicka)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class WordleDecoder
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -2,7 +2,9 @@
2
2
 
3
3
  class WordleDecoder
4
4
  class WordleShare
5
- ANSWER_LINES = ["🟩🟩🟩🟩🟩", "ggggg"].freeze
5
+ ANSWER_LINES = ["🟩🟩🟩🟩🟩",
6
+ "ggggg",
7
+ ":large_green_square:" * 5].freeze
6
8
 
7
9
  def self.final_line?(input_lines)
8
10
  ANSWER_LINES.any? { input_lines.include?(_1) }
@@ -99,11 +101,21 @@ class WordleDecoder
99
101
  VALID_HINT_CHARS = WordPosition::EMOJI_HINT_CHARS.to_a.flatten.uniq
100
102
 
101
103
  def parse_wordle_lines!
102
- input_lines.select do |line|
103
- line.each_char.all? { |c| VALID_HINT_CHARS.include?(c) }
104
+ input_lines.filter_map do |line|
105
+ line = translate_emoji_shortcodes(line)
106
+ line if line.each_char.all? { |c| VALID_HINT_CHARS.include?(c) }
104
107
  end
105
108
  end
106
109
 
110
+ SHORTCODES_TO_EMOJIS = { ":black_large_square:" => "⬛",
111
+ ":white_large_square:" => "⬜",
112
+ ":large_green_square:" => "🟩",
113
+ ":large_yellow_square:" => "🟨" }.freeze
114
+
115
+ def translate_emoji_shortcodes(line)
116
+ SHORTCODES_TO_EMOJIS.reduce(line) { |acc, (key, val)| acc.gsub(key, val) }
117
+ end
118
+
107
119
  def parse_input_lines!
108
120
  case input
109
121
  when String
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordle_decoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Ruzicka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-05 00:00:00.000000000 Z
11
+ date: 2022-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cli-ui
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.5'
27
- description: Given your Wordle share text, with some degree of confidence, the decoder
27
+ description: Given your Wordle share text, with some degree of confidence,the decoder
28
28
  will spit back the five-letter words it thinks you played.
29
29
  email:
30
30
  executables: