codebreaker_kirill 0.3.0 → 0.3.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: d3f6ed248059b392d1c1f939faa4c76261e309db02dc5cec24bf76150615c388
4
- data.tar.gz: 4693fb4f735da3bf31dbb6f7d9367162252197ee6e0d6c9d5a194b875016c112
3
+ metadata.gz: 599620e5b4307758f007792426ec78f5b034a4ca32ec1c06b93660a2beec251e
4
+ data.tar.gz: d4fa8ccd57007b90a1e63e3f9cec57d29fe5144c6e5fe6e9cb896968ded082b0
5
5
  SHA512:
6
- metadata.gz: 2ae118680b9e3ce2533aca51ca87a9d05c330cdad3e8679a7342309d9a98f44a59d6e5a5f3beb78a80d9896121dc2051cbf53fa92514ff59829668df0abf2115
7
- data.tar.gz: b39edda7c5b41000c1a2a1d19cb6df6324ff66af93e44f52142e40637b9fae908b1b8868e32cebd333b4545366b7680e1f89b1b04bb72ab27f372ff34b7cae54
6
+ metadata.gz: bb760cc9f2ef0dd5d1b873df477096029918f4910d7380b27b500597762bf6ac8b0afaf155416081dce3cc80114a12062a695ba8b1a54cffcc6a04aef3cee91a
7
+ data.tar.gz: ff28fef2f9927e20d11d22f56ca55d150ed6dc1cbac45e072840061bdb81ea1a631d3f8ba4de5e26610c19e2e7cd3c5fa0f386565fc848889b93d18faa8227e2
data/Gemfile CHANGED
@@ -8,3 +8,5 @@ gemspec
8
8
  gem 'rspec'
9
9
 
10
10
  gem 'rubocop', '~> 1.21'
11
+
12
+ gem 'simplecov', '~> 0.12.0'
data/Gemfile.lock CHANGED
@@ -1,13 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- codebreaker_kirill (0.1.0)
4
+ codebreaker_kirill (0.3.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.2)
10
10
  diff-lcs (1.5.0)
11
+ docile (1.1.5)
11
12
  json (2.6.2)
12
13
  parallel (1.22.1)
13
14
  parser (3.1.2.1)
@@ -28,7 +29,7 @@ GEM
28
29
  diff-lcs (>= 1.2.0, < 2.0)
29
30
  rspec-support (~> 3.11.0)
30
31
  rspec-support (3.11.0)
31
- rubocop (1.35.0)
32
+ rubocop (1.35.1)
32
33
  json (~> 2.3)
33
34
  parallel (~> 1.10)
34
35
  parser (>= 3.1.2.1)
@@ -41,6 +42,11 @@ GEM
41
42
  rubocop-ast (1.21.0)
42
43
  parser (>= 3.1.1.0)
43
44
  ruby-progressbar (1.11.0)
45
+ simplecov (0.12.0)
46
+ docile (~> 1.1.0)
47
+ json (>= 1.8, < 3)
48
+ simplecov-html (~> 0.10.0)
49
+ simplecov-html (0.10.2)
44
50
  unicode-display_width (2.2.0)
45
51
 
46
52
  PLATFORMS
@@ -50,6 +56,7 @@ DEPENDENCIES
50
56
  codebreaker_kirill!
51
57
  rspec
52
58
  rubocop (~> 1.21)
59
+ simplecov (~> 0.12.0)
53
60
 
54
61
  BUNDLED WITH
55
- 2.3.19
62
+ 2.3.20
@@ -6,3 +6,4 @@ require_relative 'guess_handler'
6
6
  require_relative 'settings'
7
7
  require_relative 'code_generator'
8
8
  require_relative 'stats'
9
+ require_relative 'user'
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'yaml'
4
+ require_relative 'user'
5
+
3
6
  class Stats
4
7
  def self.save_game(user)
5
8
  @data = File.exist?('stats.yml') ? YAML.load_file('stats.yml') : []
@@ -10,6 +13,19 @@ class Stats
10
13
 
11
14
  def self.show_stats
12
15
  @data = File.exist?('stats.yml') ? YAML.load_file('stats.yml') : []
13
- print @data
16
+ @data.each_with_index do |user, index|
17
+ stats_format(user, index)
18
+ end
19
+ end
20
+
21
+ def self.stats_format(user, index)
22
+ index += 1
23
+ puts "Rating: #{index}", "Name: #{user.name}",
24
+ "Difficulty: #{Settings::DIFFICULTY.key({ attempts: user.attempts[:all], hints: user.hints[:all] })}",
25
+ "Available Attempts: #{user.attempts[:all]}",
26
+ "Used Attempts: #{user.attempts[:used]}",
27
+ "Available Hints: #{user.hints[:all]}",
28
+ "Used Hints: #{user.hints[:used]}",
29
+ '-----------------------'
14
30
  end
15
31
  end
@@ -0,0 +1,34 @@
1
+ ---
2
+ - !ruby/object:User
3
+ name: kirill
4
+ difficulty:
5
+ :attempts: 5
6
+ :hints: 1
7
+ attempts:
8
+ :all: 5
9
+ :used: 0
10
+ hints:
11
+ :all: 1
12
+ :used: 0
13
+ - !ruby/object:User
14
+ name: Stacy
15
+ difficulty:
16
+ :attempts: 10
17
+ :hints: 1
18
+ attempts:
19
+ :all: 10
20
+ :used: 0
21
+ hints:
22
+ :all: 1
23
+ :used: 1
24
+ - !ruby/object:User
25
+ name: Dima
26
+ difficulty:
27
+ :attempts: 5
28
+ :hints: 1
29
+ attempts:
30
+ :all: 5
31
+ :used: 2
32
+ hints:
33
+ :all: 1
34
+ :used: 0
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'autoload'
4
3
  require_relative 'settings'
5
4
 
6
5
  class User
@@ -14,7 +13,7 @@ class User
14
13
  @hints = { all: @difficulty[:hints], used: 0 }
15
14
  end
16
15
 
17
- def validation(_input)
16
+ def validation(name, difficulty)
18
17
  Validations.validate_name(name)
19
18
  Validations.validate_difficulty(difficulty)
20
19
  rescue StandardError => e
@@ -3,5 +3,5 @@
3
3
  require_relative 'game'
4
4
 
5
5
  module CodebreakerKirill
6
- VERSION = '0.3.0'
6
+ VERSION = '0.3.3'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codebreaker_kirill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Dudchenko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-19 00:00:00.000000000 Z
11
+ date: 2022-08-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -32,6 +32,7 @@ files:
32
32
  - lib/codebreaker_kirill/guess_handler.rb
33
33
  - lib/codebreaker_kirill/settings.rb
34
34
  - lib/codebreaker_kirill/stats.rb
35
+ - lib/codebreaker_kirill/stats.yml
35
36
  - lib/codebreaker_kirill/user.rb
36
37
  - lib/codebreaker_kirill/validations.rb
37
38
  - lib/codebreaker_kirill/version.rb
@@ -55,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
56
  - !ruby/object:Gem::Version
56
57
  version: '0'
57
58
  requirements: []
58
- rubygems_version: 3.0.3.1
59
+ rubygems_version: 3.3.20
59
60
  signing_key:
60
61
  specification_version: 4
61
62
  summary: Logic game