codebreaker_kirill 0.3.1 → 0.3.2

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: 42247fb0876ec4ccc153b8ea388699b2554fa77df10350ff5d5593d4732b0cb4
4
- data.tar.gz: 3b93911002084a839fbfe931fd5aa70833bb1a60b54500ad6774a9cfdb8d5e58
3
+ metadata.gz: 73646f79231fa52be49e3228ef5e3f16b814ac331e156adffd78e10816280f5d
4
+ data.tar.gz: fc3a106ca28d4fa493697f29668acbbc8a01bb45457a2c65d297b55dcd4d1bab
5
5
  SHA512:
6
- metadata.gz: 6b672feeb7094d448091b0fcde89597dae42d3c51605cdc29b7b5b3fbe8aaec5695e342d67fa149672540b511741e92c9bda3d73fa39eca964e2fd42eb856cde
7
- data.tar.gz: 4298392ee1d2376a614c625405ad2c101476c7a64d01f25761c11a1f64df1c5f57a3d92325eb716f139fe3240d618f88c5da0641a315b2a411ce0adb0a049e89
6
+ metadata.gz: af7cac1998d5cbd213c6f2f65d67d5da2e0bf275d326fa8faa068d337dcca9292f0f8110a02a3f1cbcbb0615e54482a4ff52f32d582100948d3688866cd6c343
7
+ data.tar.gz: 43e23d476945d8f9c96b60d58ac5f84264f5f9efe8d84104bfa41758ad70769d073aa7de8838c05d254b09e45812496e0710d3b10c5daa3e8d508274470dd759
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,21 @@ 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
32
+
33
+ Stats.show_stats
@@ -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
@@ -3,5 +3,5 @@
3
3
  require_relative 'game'
4
4
 
5
5
  module CodebreakerKirill
6
- VERSION = '0.3.1'
6
+ VERSION = '0.3.2'
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.1
4
+ version: 0.3.2
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