word_games_test 0.0.1

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.
@@ -0,0 +1,21 @@
1
+ class WordGamesTest::WordGamesDictionary
2
+
3
+ def initialize(complexity_level, is_wordle = false)
4
+ @complexity_level = complexity_level
5
+ @is_wordle = is_wordle
6
+ dict_file_path = File.absolute_path("#{__dir__}/dict_files/Dict#{complexity_level}#{is_wordle ? 'Wordle' : ''}.txt")
7
+ begin
8
+ @dict_array = IO.readlines(dict_file_path, chomp: true)
9
+ rescue Errno::ENOENT
10
+ p "No such dictionary file: #{dict_file_path}"
11
+ end
12
+ end
13
+
14
+ def choose_word
15
+ return @dict_array.sample
16
+ end
17
+
18
+ def is_word?(word)
19
+ return @dict_array.include?(word)
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ class WordGamesTest
2
+ def initialize
3
+ p "word_games_test"
4
+ end
5
+ end
6
+
7
+ require 'word_games_test/word_games_dictionary'
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: word_games_test
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Noah Burns
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: test
14
+ email:
15
+ executables:
16
+ - word_choice
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/word_choice
21
+ - lib/word_games_test.rb
22
+ - lib/word_games_test/dict_files/Dict1Wordle.txt
23
+ - lib/word_games_test/dict_files/Dict2Wordle.txt
24
+ - lib/word_games_test/word_games_dictionary.rb
25
+ homepage:
26
+ licenses: []
27
+ metadata: {}
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubygems_version: 3.1.2
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Word game module
47
+ test_files: []