codebreaker_PI 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/codebreaker/version.rb +1 -1
- data/lib/entities/game.rb +6 -6
- data/lib/entities/statistics.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4810214ae09c5898e8f02edea9eaa87f664d542f87e403870268c004fbf0f0a0
|
4
|
+
data.tar.gz: 7d29c80cd56cf4937a037a62b6f5f9a233abbfb07f71557cb63509ae1b67614a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38629beb71be0b8b21dd2b43629b7bd570f632fd0d88dcc0d2ffbd884236c130c8a6c62e8dddd6c37158fb2ffe16f0c9bd2b6c3c4384a44a62f9cd57860f6681
|
7
|
+
data.tar.gz: 66023a41dbf23c6510fd72e223f00a21f06682801052147ca6aed568461d865593ae946f3f598d7e986d173f0cb377ee3b67371bd97d99bfd7e2a9b739e51db3
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
codebreaker_PI (0.6.
|
4
|
+
codebreaker_PI (0.6.5)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
jaro_winkler (1.5.2)
|
17
17
|
json (2.1.0)
|
18
18
|
method_source (0.9.2)
|
19
|
-
parallel (1.
|
19
|
+
parallel (1.13.0)
|
20
20
|
parser (2.6.0.0)
|
21
21
|
ast (~> 2.4.0)
|
22
22
|
powerpack (0.1.2)
|
data/lib/codebreaker/version.rb
CHANGED
data/lib/entities/game.rb
CHANGED
@@ -14,7 +14,7 @@ module Codebreaker
|
|
14
14
|
RANGE_OF_DIGITS = 1..6.freeze
|
15
15
|
GUESS_CODE = { hint: 'hint', leave: 'exit' }.freeze
|
16
16
|
|
17
|
-
attr_reader :got_hints, :secret_code, :name, :hints_total, :have_hints, :attempts_total, :hints_used, :attempts_used, :difficulty, :winner, :attempts_left
|
17
|
+
attr_reader :date, :got_hints, :secret_code, :name, :hints_total, :have_hints, :attempts_total, :hints_used, :attempts_used, :difficulty, :winner, :attempts_left
|
18
18
|
attr_accessor :errors
|
19
19
|
|
20
20
|
def game_options(user_difficulty:, player:)
|
@@ -49,6 +49,11 @@ module Codebreaker
|
|
49
49
|
remove_instance_variable(:@have_hints) if @have_hints
|
50
50
|
end
|
51
51
|
|
52
|
+
def secret_code
|
53
|
+
@secret_code ||= Array.new(AMOUNT_DIGITS) { rand(RANGE_OF_DIGITS) }.join('')
|
54
|
+
convert_to_array(@secret_code)
|
55
|
+
end
|
56
|
+
|
52
57
|
private
|
53
58
|
|
54
59
|
def hint?(input)
|
@@ -98,11 +103,6 @@ module Codebreaker
|
|
98
103
|
user_code == secret_code
|
99
104
|
end
|
100
105
|
|
101
|
-
def secret_code
|
102
|
-
@secret_code ||= Array.new(AMOUNT_DIGITS) { rand(RANGE_OF_DIGITS) }.join('')
|
103
|
-
convert_to_array(@secret_code)
|
104
|
-
end
|
105
|
-
|
106
106
|
def guessing(user_code)
|
107
107
|
count_attempt
|
108
108
|
@date = Time.new and return @winner = true if compare_with_right_code(user_code)
|
data/lib/entities/statistics.rb
CHANGED
@@ -16,9 +16,10 @@ module Codebreaker
|
|
16
16
|
row << i.name
|
17
17
|
row << i.difficulty
|
18
18
|
row << i.attempts_total
|
19
|
-
row << i.
|
19
|
+
row << i.attempts_left
|
20
20
|
row << i.hints_total
|
21
|
-
row << i.
|
21
|
+
row << i.have_hints
|
22
|
+
row << i.date
|
22
23
|
rows << row
|
23
24
|
end
|
24
25
|
rows
|