wordle_decoder 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -2
- data/Gemfile.lock +1 -1
- data/README.md +22 -5
- data/lib/wordle_decoder/version.rb +1 -1
- data/lib/wordle_decoder/wordle_share.rb +15 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f99c89b38bbf201f3cc823ce9cb134d952b2b58a9fd0832f92bfab41e63bd01
|
4
|
+
data.tar.gz: bcd052c478b24f5e0b5d360007688f04edd0c5fd47c8870f426759168fe4cc97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9641a6f0cce9a39b9b137a72ef8e7fc9cf0cb310ca658c2182cfe9aa3c8c66916ccacfcd76ea57236c8fd3b7e25182b9833433453f25acadbd31e35f4ca1a037
|
7
|
+
data.tar.gz: 6f39d15f60434b8a88a30c018b9860198c3d7080566a937cabd0d2d152232e599fb10e7b0a85969e405651c67c8cc65a681fcd0c5eaaf248d7aef1f58b075cd5
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,19 +1,36 @@
|
|
1
1
|
# Wordle Decoder
|
2
2
|
|
3
|
-
It guesses your guesses based on all those little
|
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
|
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
|
15
|
+
After installing the gem, run `wordle_decoder` at the command line like so:
|
14
16
|
|
15
17
|
$ wordle_decoder
|
16
18
|
|
17
|
-
|
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
|
-
|
36
|
+
[@mattruzicka](https://twitter.com/mattruzicka)
|
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
class WordleDecoder
|
4
4
|
class WordleShare
|
5
|
-
ANSWER_LINES = ["🟩🟩🟩🟩🟩",
|
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.
|
103
|
-
line
|
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.
|
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-
|
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,
|
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:
|