codebreaker_bo 0.1.5 → 0.1.6

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: 9944c5101dc90e5ff2ef8fa18e8692c76a17ee53377560ed1004d7ccf0431fd8
4
- data.tar.gz: 9050baa0eeaaaee224a1b458d4c71eeff6269b57645eab0f35d33ca3901a60e7
3
+ metadata.gz: 41c74c3d34c0613fd1561253030059a6ab61222e8aad34dc7d99e0b31f767456
4
+ data.tar.gz: 1d2d4570474a1e19262905b22a126e61e43dc9c9f97446b2984984f8a5b6b4c9
5
5
  SHA512:
6
- metadata.gz: e40e2ff6dee2172547206c1bb62da931b411675c4ba0a88c431a031d7d844666011080af6210406c2143fbd41c1aa22d302f2743d173e55c64e722c748b1b250
7
- data.tar.gz: eccc9f39f593bd893e8f8b61fa9c6fee27a0fdc549d3d0c5c2b9963c4435319c60c783559cd18ec59a294fb898d45a57e6cfcfab199a91e8e4e86804b91ef959
6
+ metadata.gz: c6665492feee77e52af8e1838178520bb331d95c0964510ebf53f0f7624aa79baa157ada381223c480471efc40be6f2c7c9b8f9367bccbcb60a18419c6685370
7
+ data.tar.gz: c5ad83a10e7fd5948d97ec0ddcbe123bd84a88efb2780e2bd1d98584fb47abedfd80a1098ea246f8a3a0b0f1189b285cc28b10a7972cd2a00c6d15685b74edb7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- codebreaker_bo (0.1.5)
4
+ codebreaker_bo (0.1.6)
5
5
  json (~> 2.6.1)
6
6
 
7
7
  GEM
File without changes
File without changes
File without changes
@@ -1,13 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Constants
4
- EASY = { attempts: 15,
5
- hints: 2 }.freeze
4
+ LEVELS = {
5
+ easy: { attempts: 15, hints: 2 },
6
+ medium: { attempts: 10, hints: 1 },
7
+ hell: { attempts: 5, hints: 1 }
8
+ }.freeze
6
9
 
7
- MEDIUM = { attempts: 10,
8
- hints: 1 }.freeze
9
- HELL = { attempts: 5,
10
- hints: 1 }.freeze
11
10
  PLUS = '+'
12
11
  MINUS = '-'
13
12
  WIN_NUMBER = 4
@@ -17,8 +17,14 @@ module Codebreaker
17
17
  end
18
18
 
19
19
  def save_stats
20
- hash = { user_name: @player_name, difficulty: level, attempts_total: total_attempts, attempts_used: used_attempts,
21
- hints_total: total_hints, hints_used: used_hints }
20
+ hash = {
21
+ user_name: @player_name,
22
+ difficulty: level,
23
+ attempts_total: total_attempts,
24
+ attempts_used: used_attempts,
25
+ hints_total: total_hints,
26
+ hints_used: used_hints
27
+ }
22
28
  @stat.collect_statistic(hash)
23
29
  end
24
30
 
@@ -41,18 +47,23 @@ module Codebreaker
41
47
  end
42
48
 
43
49
  def accept_level(level)
44
- level = level.upcase
45
- Object.const_get "Constants::#{level}"
46
- rescue StandardError
47
- handle_errors('entered level is not present')
48
- nil
50
+ current_level = Constants::LEVELS[level.to_sym]
51
+ handle_errors('entered level is not present') unless current_level
52
+ current_level
49
53
  end
50
54
 
51
55
  def create_level(level)
52
56
  choice_level = accept_level(level)
53
57
  return if choice_level.nil?
54
- return unless @level.nil?
55
58
 
59
+ add_level(choice_level)
60
+ end
61
+
62
+ def difficulties
63
+ Constants::LEVELS.keys
64
+ end
65
+
66
+ def add_level(choice_level)
56
67
  @level = level
57
68
  @used_hints = choice_level[:hints]
58
69
  @total_hints = choice_level[:hints]
File without changes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Codebreaker
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codebreaker_bo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oladko Bohdan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-30 00:00:00.000000000 Z
11
+ date: 2022-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -159,10 +159,6 @@ extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
161
  - ".idea/.gitignore"
162
- - ".idea/codebreaker.iml"
163
- - ".idea/misc.xml"
164
- - ".idea/modules.xml"
165
- - ".idea/vcs.xml"
166
162
  - ".rspec"
167
163
  - ".rubocop.yml"
168
164
  - CHANGELOG.md
@@ -173,12 +169,15 @@ files:
173
169
  - README.md
174
170
  - Rakefile
175
171
  - data/statistic.yml
176
- - e_attempts
177
172
  - lib/codebreaker.rb
178
173
  - lib/codebreaker/base_class.rb
174
+ - lib/codebreaker/config.rb
175
+ - lib/codebreaker/console.rb
176
+ - lib/codebreaker/const.rb
179
177
  - lib/codebreaker/constant.rb
180
178
  - lib/codebreaker/game.rb
181
179
  - lib/codebreaker/statistic.rb
180
+ - lib/codebreaker/test_console.rb
182
181
  - lib/codebreaker/user.rb
183
182
  - lib/codebreaker/validation.rb
184
183
  - lib/codebreaker/version.rb
@@ -1,86 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="ModuleRunConfigurationManager">
4
- <shared />
5
- </component>
6
- <component name="NewModuleRootManager">
7
- <content url="file://$MODULE_DIR$">
8
- <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
- <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
- <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
- </content>
12
- <orderEntry type="inheritedJdk" />
13
- <orderEntry type="sourceFolder" forTests="false" />
14
- <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-3.1.0) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="bundler (v2.3.9, RVM: ruby-3.1.0) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.3, RVM: ruby-3.1.0) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, RVM: ruby-3.1.0) [gem]" level="application" />
18
- <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, RVM: ruby-3.1.0) [gem]" level="application" />
19
- <orderEntry type="library" scope="PROVIDED" name="docile (v1.4.0, RVM: ruby-3.1.0) [gem]" level="application" />
20
- <orderEntry type="library" scope="PROVIDED" name="fasterer (v0.9.0, RVM: ruby-3.1.0) [gem]" level="application" />
21
- <orderEntry type="library" scope="PROVIDED" name="json (v2.6.1, RVM: ruby-3.1.0) [gem]" level="application" />
22
- <orderEntry type="library" scope="PROVIDED" name="lefthook (v0.7.7, RVM: ruby-3.1.0) [gem]" level="application" />
23
- <orderEntry type="library" scope="PROVIDED" name="method_source (v1.0.0, RVM: ruby-3.1.0) [gem]" level="application" />
24
- <orderEntry type="library" scope="PROVIDED" name="parallel (v1.21.0, RVM: ruby-3.1.0) [gem]" level="application" />
25
- <orderEntry type="library" scope="PROVIDED" name="parser (v3.1.0.0, RVM: ruby-3.1.0) [gem]" level="application" />
26
- <orderEntry type="library" scope="PROVIDED" name="pry (v0.14.1, RVM: ruby-3.1.0) [gem]" level="application" />
27
- <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-3.1.0) [gem]" level="application" />
28
- <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-3.1.0) [gem]" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.2.1, RVM: ruby-3.1.0) [gem]" level="application" />
30
- <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-3.1.0) [gem]" level="application" />
31
- <orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, RVM: ruby-3.1.0) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0, RVM: ruby-3.1.0) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, RVM: ruby-3.1.0) [gem]" level="application" />
34
- <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.0, RVM: ruby-3.1.0) [gem]" level="application" />
35
- <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, RVM: ruby-3.1.0) [gem]" level="application" />
36
- <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.25.1, RVM: ruby-3.1.0) [gem]" level="application" />
37
- <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.15.2, RVM: ruby-3.1.0) [gem]" level="application" />
38
- <orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v2.9.0, RVM: ruby-3.1.0) [gem]" level="application" />
39
- <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-3.1.0) [gem]" level="application" />
40
- <orderEntry type="library" scope="PROVIDED" name="ruby_parser (v3.18.1, RVM: ruby-3.1.0) [gem]" level="application" />
41
- <orderEntry type="library" scope="PROVIDED" name="sexp_processor (v4.16.0, RVM: ruby-3.1.0) [gem]" level="application" />
42
- <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.21.2, RVM: ruby-3.1.0) [gem]" level="application" />
43
- <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.12.3, RVM: ruby-3.1.0) [gem]" level="application" />
44
- <orderEntry type="library" scope="PROVIDED" name="simplecov_json_formatter (v0.1.4, RVM: ruby-3.1.0) [gem]" level="application" />
45
- <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, RVM: ruby-3.1.0) [gem]" level="application" />
46
- </component>
47
- <component name="RakeTasksCache">
48
- <option name="myRootTask">
49
- <RakeTaskImpl id="rake">
50
- <subtasks>
51
- <RakeTaskImpl description="Build codebreaker_bo-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
52
- <RakeTaskImpl id="build">
53
- <subtasks>
54
- <RakeTaskImpl description="Generate SHA512 checksum if codebreaker_bo-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
55
- </subtasks>
56
- </RakeTaskImpl>
57
- <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
58
- <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
59
- <RakeTaskImpl description="Build and install codebreaker_bo-0.1.0.gem into system gems" fullCommand="install" id="install" />
60
- <RakeTaskImpl id="install">
61
- <subtasks>
62
- <RakeTaskImpl description="Build and install codebreaker_bo-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
63
- </subtasks>
64
- </RakeTaskImpl>
65
- <RakeTaskImpl description="Create tag v0.1.0 and build and push codebreaker_bo-0.1.0.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
66
- <RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
67
- <RakeTaskImpl id="rubocop">
68
- <subtasks>
69
- <RakeTaskImpl description="Auto-correct RuboCop offenses" fullCommand="rubocop:auto_correct" id="auto_correct" />
70
- </subtasks>
71
- </RakeTaskImpl>
72
- <RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
73
- <RakeTaskImpl description="" fullCommand="default" id="default" />
74
- <RakeTaskImpl description="" fullCommand="release" id="release" />
75
- <RakeTaskImpl id="release">
76
- <subtasks>
77
- <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
78
- <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
79
- <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
80
- </subtasks>
81
- </RakeTaskImpl>
82
- </subtasks>
83
- </RakeTaskImpl>
84
- </option>
85
- </component>
86
- </module>
data/.idea/misc.xml DELETED
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-3.1.0" project-jdk-type="RUBY_SDK" />
4
- </project>
data/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/codebreaker.iml" filepath="$PROJECT_DIR$/.idea/codebreaker.iml" />
6
- </modules>
7
- </component>
8
- </project>
data/.idea/vcs.xml DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- <mapping directory="$PROJECT_DIR$/codebreaker" vcs="Git" />
6
- </component>
7
- </project>
data/e_attempts DELETED
@@ -1,20 +0,0 @@
1
-
2
- From: /home/bo/rubypr/codebreaker/lib/codebreaker/Console.rb:75 Console#game_process:
3
-
4
- 74: def game_process
5
- => 75: binding.pry
6
- 76: if !game.decrease_attempts == game.secret_code && 'lose'
7
- 77: p game
8
- 78: game_actions
9
- 79: end
10
- 80:
11
- 81: # if !game.used_attempts.nil? && !game.used_attempts.zero?
12
- 82: # p game
13
- 83: # game_actions
14
- 84: # else
15
- 85: # p 'attempts finished'
16
- 86: # lose
17
- 87: # new_process
18
- 88: # end
19
- 89: end
20
-