codebreaker_kosinskiy 0.1.0 → 0.1.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: 242cb2b03eac9c28f40137c33167ce45f9eeac6d1e8cfe54a37f33e759f25e58
4
- data.tar.gz: c55c2eb97d213d93d2cbd102e98468527df8f74383553493794f8fa07ba7603a
3
+ metadata.gz: f5ebb07bce36ec46ba0f1c0a151d828ac0bf82c993fd05c8b5c123881a9b23ee
4
+ data.tar.gz: fdbfc701d0ced20dba5678af1ec707d1f169b46fab6276dc4ee3f99a8e323134
5
5
  SHA512:
6
- metadata.gz: aea4f45508822be73a61f9d75c5c65254f185105e64df51c60db253b8e6566ba2b13f2e0ec755e17fd2daf1540536f42c1ebeed60ebce9496210fb8b2816650b
7
- data.tar.gz: 4d96dc4ce6e810e740a2e7f78cab59f61222aaf819dfd2b0869d3e751bd84a4638f65bbaa43aff5b5ae364e1e3c8ba14813d23f0dd77142168f95ddf33d03e72
6
+ metadata.gz: '029ce87f3ae4ba0f0bba15c683214575fa0651412dc9ee51d077b10eaf6f668932cf9e0bec21bdcee689dd698af0d702fa11c0625f89cfbacf8dca7faf2480a4'
7
+ data.tar.gz: 392b3682f5f97333b3c3b214ee5580df20afd44db4e08a5de4b3c115aa2497d51b712e01871614c6ae2b11466f40f64ea34adc958e70ccfc27f77eb143ad9184
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- codebreaker_kosinskiy (0.1.0)
4
+ codebreaker_kosinskiy (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/data.yaml CHANGED
@@ -1,9 +1,6 @@
1
1
  ---
2
- - !ruby/object:Statistic::StatisticRow
3
- rating: 1
4
- player_name: Andrey
5
- difficult_name: easy
6
- init_attempts_count: 15
7
- init_hints_count: 2
8
- used_attempts_count: 0
9
- used_hits_count: 0
2
+ - 1
3
+ - 2
4
+ - 2
5
+ - 3
6
+ - 4
@@ -50,7 +50,12 @@ module Game
50
50
  @current_stat.init_attempts_count > @current_stat.used_attempts_count
51
51
  end
52
52
 
53
+ def can_use_hints?
54
+ @current_stat.init_hints_count > @current_stat.used_hints_count
55
+ end
56
+
53
57
  def hint
58
+ @current_stat.used_hints_count += 1 if can_use_hints?
54
59
  @hint.hint
55
60
  end
56
61
  end
@@ -1,7 +1,7 @@
1
1
  module Statistic
2
2
  class StatisticRow
3
3
  attr_accessor :player_name, :init_attempts_count, :init_hints_count,
4
- :used_attempts_count, :used_hits_count, :difficult_name,
4
+ :used_attempts_count, :used_hints_count, :difficult_name,
5
5
  :rating
6
6
 
7
7
  def initialize(player:, difficult_init:)
@@ -11,7 +11,7 @@ module Statistic
11
11
  @init_attempts_count = difficult_init.attempts_count
12
12
  @init_hints_count = difficult_init.hint.hints_count
13
13
  @used_attempts_count = 0
14
- @used_hits_count = 0
14
+ @used_hints_count = 0
15
15
  end
16
16
  end
17
17
  end
@@ -14,7 +14,7 @@ module Statistic
14
14
  @rows = @new_row
15
15
  else
16
16
  @rows.append(@new_row)
17
- @rows.sort_by! { |row| [row.init_attempts_count, row.used_attempts_count, row.used_hits_count] }
17
+ @rows.sort_by! { |row| [row.init_attempts_count, row.used_attempts_count, row.used_hints_count] }
18
18
  @rows.map.with_index { |row, rating| row.rating = rating + 1 }
19
19
  end
20
20
  @storage.store(@rows)
@@ -1,3 +1,3 @@
1
1
  module Codebreaker
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codebreaker_kosinskiy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kosinskiy Andrey