codebreaker_kirill 0.3.2 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73646f79231fa52be49e3228ef5e3f16b814ac331e156adffd78e10816280f5d
4
- data.tar.gz: fc3a106ca28d4fa493697f29668acbbc8a01bb45457a2c65d297b55dcd4d1bab
3
+ metadata.gz: d6329eb1e53ca286953697590e45bbacac554c3fc42c65558f56123ddf00b70d
4
+ data.tar.gz: 4d9789da37d7c34db92a853f19cb4d17e666e6257e838913bf2340f27573f965
5
5
  SHA512:
6
- metadata.gz: af7cac1998d5cbd213c6f2f65d67d5da2e0bf275d326fa8faa068d337dcca9292f0f8110a02a3f1cbcbb0615e54482a4ff52f32d582100948d3688866cd6c343
7
- data.tar.gz: 43e23d476945d8f9c96b60d58ac5f84264f5f9efe8d84104bfa41758ad70769d073aa7de8838c05d254b09e45812496e0710d3b10c5daa3e8d508274470dd759
6
+ metadata.gz: b45dc27721b3bd18ba5fa6c45518c9364779a72b296f5c8679d066789f952e5f9a35026366f75c79b3dbdf473936fc395af3daa2bb349f499f40f3a34457fcc3
7
+ data.tar.gz: f1f1d2bcfcb52edc993971764f3ac2fe1b2b6b8c6822bc6a8effd32507df65fbb46ef90a3a058042a48c21b40c314229edfe62e0ca98d04d327a2ec166c4737a
@@ -13,6 +13,7 @@ class Stats
13
13
 
14
14
  def self.show_stats
15
15
  @data = File.exist?('stats.yml') ? YAML.load_file('stats.yml') : []
16
+ @data.sort_by! { |user| [user.attempts[:all], user.attempts[:used], user.hints[:used]] }
16
17
  @data.each_with_index do |user, index|
17
18
  stats_format(user, index)
18
19
  end
@@ -29,5 +30,3 @@ class Stats
29
30
  '-----------------------'
30
31
  end
31
32
  end
32
-
33
- Stats.show_stats
@@ -6,7 +6,11 @@ class User
6
6
  attr_reader :name, :difficulty, :attempts, :hints
7
7
 
8
8
  def initialize(name, difficulty)
9
- validation(name, difficulty)
9
+ begin
10
+ validation(name, difficulty)
11
+ rescue StandardError => e
12
+ puts e.message
13
+ end
10
14
  @name = name
11
15
  @difficulty = Settings::DIFFICULTY[difficulty]
12
16
  @attempts = { all: @difficulty[:attempts], used: 0 }
@@ -16,8 +20,5 @@ class User
16
20
  def validation(name, difficulty)
17
21
  Validations.validate_name(name)
18
22
  Validations.validate_difficulty(difficulty)
19
- rescue StandardError => e
20
- puts e.message
21
- nil
22
23
  end
23
24
  end
@@ -3,5 +3,5 @@
3
3
  require_relative 'game'
4
4
 
5
5
  module CodebreakerKirill
6
- VERSION = '0.3.2'
6
+ VERSION = '1.0.1'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codebreaker_kirill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Dudchenko
@@ -32,7 +32,6 @@ 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
36
35
  - lib/codebreaker_kirill/user.rb
37
36
  - lib/codebreaker_kirill/validations.rb
38
37
  - lib/codebreaker_kirill/version.rb
@@ -1,34 +0,0 @@
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