wordle 0.1.0 → 0.3.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: ae365a30fe124cd128e3899cf18a13204681febb784443b337912769a14fe02a
4
- data.tar.gz: 97cb0fd7a71c4f7f6e990f131088e0ffff730696b46c5e00b561ab8827e1ffe6
3
+ metadata.gz: ff0c43c46f9e5e2e25088128a3cd8e2f634bda564b98a0b36473c0d9fb1a25b7
4
+ data.tar.gz: bbcaf825639fd41c6388b501388cc108048d1c4464e59a3cad7eaa2451586679
5
5
  SHA512:
6
- metadata.gz: e76742605ae1d736201b618fff575146d2635f15f62373ae843d2072b012991e1e01c75e3f04df97e008845c728e041aa29066c2e065ad9eb957159a678d2534
7
- data.tar.gz: caa7e430875ec1abbd9349520e838c667df16a5bd1555130634f7bf3778d494b1434f3777dfe94c4642c297ac0336be429b52364ffe64cf2a8c25e632ee9588f
6
+ metadata.gz: 366f914646b492bd8c00f4a4334db6ebb494b447cd54c34ea0d6c47310be1ab7ed3af5662c05daf5bcf8056dbb0899db2848599525ed17859eb40e6b111d500b
7
+ data.tar.gz: 1a21fa7349041d534f29588cb45b9ca41e4e0deef0d6812de0e1384a80613a94667b925b3c32cacf9d6d99bc587807b0419f416a9b6ebe16cb43142d1de13cce
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
- ## [Unreleased]
1
+ ## [0.3.0] - 2022-01-10
2
2
 
3
- ## [0.1.0] - 2022-01-09
3
+ - Adds a better world list. From the Wordle source itself : )
4
+
5
+ ## [0.2.1] - 2022-01-10
6
+
7
+ - Adds legend for colors
8
+
9
+ ## [0.2.0] - 2022-01-09
10
+
11
+ - Actually tells you what the word was if you don't win!
12
+
13
+ ## [0.1.1] - 2022-01-09
4
14
 
5
15
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wordle (0.1.0)
4
+ wordle (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -50,6 +50,7 @@ GEM
50
50
 
51
51
  PLATFORMS
52
52
  x86_64-darwin-21
53
+ x86_64-linux
53
54
 
54
55
  DEPENDENCIES
55
56
  rake (~> 13.0)
data/README.md CHANGED
@@ -1,28 +1,17 @@
1
1
  # Wordle
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/wordle`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Ruby implementation of [Wordle](https://www.powerlanguage.co.uk/wordle/).
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ <img width="794" alt="Screen Shot 2022-01-10 at 9 18 19 PM" src="https://user-images.githubusercontent.com/22665228/148885575-39805830-274e-40e6-be14-4c6bc6db37ec.png">
6
6
 
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'wordle'
13
- ```
14
7
 
15
- And then execute:
16
-
17
- $ bundle install
18
-
19
- Or install it yourself as:
8
+ ## Installation
20
9
 
21
- $ gem install wordle
10
+ `gem install wordle`
22
11
 
23
12
  ## Usage
24
13
 
25
- TODO: Write usage instructions here
14
+ Just run `wordle` from the command line.
26
15
 
27
16
  ## Development
28
17
 
@@ -32,7 +21,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
21
 
33
22
  ## Contributing
34
23
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/wordle. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/wordle/blob/main/CODE_OF_CONDUCT.md).
24
+ Bug reports and pull requests are welcome on GitHub at https://github.com/JonathanWThom/wordle. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/JonathanWThom/wordle/blob/main/CODE_OF_CONDUCT.md).
36
25
 
37
26
  ## License
38
27
 
@@ -40,4 +29,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
40
29
 
41
30
  ## Code of Conduct
42
31
 
43
- Everyone interacting in the Wordle project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/wordle/blob/main/CODE_OF_CONDUCT.md).
32
+ Everyone interacting in the Wordle project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/JonathanWThom/wordle/blob/main/CODE_OF_CONDUCT.md).
data/lib/wordle/game.rb CHANGED
@@ -18,6 +18,7 @@ module Wordle
18
18
  winner = false
19
19
  attempts = 0
20
20
 
21
+ Legend.print
21
22
  puts "Guess a 5 letter word: "
22
23
 
23
24
  while attempts < 6 && !winner
@@ -41,9 +42,10 @@ module Wordle
41
42
  end
42
43
 
43
44
  if winner
44
- puts "winner!"
45
+ puts "Winner!"
45
46
  else
46
- puts "better luck next time!"
47
+ puts "Word was: #{@target_word}"
48
+ puts "Better luck next time!"
47
49
  end
48
50
  end
49
51
 
@@ -14,17 +14,17 @@ module Wordle
14
14
  end
15
15
 
16
16
  def colors
17
- target_letters = @target_word.split("")
18
- guess_letters = @guess.split("")
17
+ target_letters = @target_word.chars
18
+ guess_letters = @guess.chars
19
19
  colored_letters = ""
20
20
 
21
21
  guess_letters.each_with_index do |letter, i|
22
- if letter == target_letters[i]
23
- colored_letters += letter.green
22
+ colored_letters += if letter == target_letters[i]
23
+ letter.green
24
24
  elsif target_letters.include?(letter)
25
- colored_letters += letter.yellow
25
+ letter.yellow
26
26
  else
27
- colored_letters += letter.gray
27
+ letter.gray
28
28
  end
29
29
  end
30
30
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Wordle
3
4
  class GuessValidator
4
5
  attr_reader :error
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wordle
4
+ class Legend
5
+ def self.print
6
+ new.print
7
+ end
8
+
9
+ def print
10
+ puts green_example
11
+ puts yellow_example
12
+ puts gray_example
13
+ end
14
+
15
+ private
16
+
17
+ def green_example
18
+ "#{"w".green}eary - The letter w is in the word and in the correct spot."
19
+ end
20
+
21
+ def yellow_example
22
+ "p#{"i".yellow}lls - The letter i is in the word but in the wrong spot."
23
+ end
24
+
25
+ def gray_example
26
+ "vag#{"u".gray}e - The letter u is not in the word in any spot."
27
+ end
28
+ end
29
+ end
data/lib/wordle/list.rb CHANGED
@@ -17,12 +17,7 @@ module Wordle
17
17
  private
18
18
 
19
19
  def list
20
- # fall back to api if this fails?
21
- @_list ||= begin
22
- File.readlines("/usr/share/dict/words").select do |word|
23
- word.strip.length == @length
24
- end.map { |w| w.downcase.strip } # sanitize class to standarize this?
25
- end
20
+ @_list ||= Wordle::SOURCE
26
21
  end
27
22
  end
28
23
  end