codebreaker_kosinskiy 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5ebb07bce36ec46ba0f1c0a151d828ac0bf82c993fd05c8b5c123881a9b23ee
|
4
|
+
data.tar.gz: fdbfc701d0ced20dba5678af1ec707d1f169b46fab6276dc4ee3f99a8e323134
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '029ce87f3ae4ba0f0bba15c683214575fa0651412dc9ee51d077b10eaf6f668932cf9e0bec21bdcee689dd698af0d702fa11c0625f89cfbacf8dca7faf2480a4'
|
7
|
+
data.tar.gz: 392b3682f5f97333b3c3b214ee5580df20afd44db4e08a5de4b3c115aa2497d51b712e01871614c6ae2b11466f40f64ea34adc958e70ccfc27f77eb143ad9184
|
data/Gemfile.lock
CHANGED
data/data.yaml
CHANGED
@@ -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, :
|
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
|
-
@
|
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.
|
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)
|
data/lib/codebreaker/version.rb
CHANGED