codebreaker-d3n 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/codebreaker/game.rb +5 -1
- data/lib/codebreaker/version.rb +1 -1
- 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: 1501eb4f3a042fd41144cd9dcd24b28153070529fe2e7ce3e91c9a8ef9ae1ce9
|
4
|
+
data.tar.gz: ddc028c8a615ed0f4e3a4272e4b88c54fec253cbac5d7aa8e709678209ca43f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfab6fcaeef82f9a3eb08f1318e6495816e0d0569180b144e03776824b1bc9f59187346dab331112081357eb7ac744c44674049a9b2e66ca25277570d61871c0
|
7
|
+
data.tar.gz: ef3555eb759643b79ffe714f450dfdc1c8994e05efd824cb0dfd99e6b77d35c40a287a3c1712a83f5993cd136fc8d843fd554a628c01616da40b2620ec5b055f
|
data/Gemfile.lock
CHANGED
data/lib/codebreaker/game.rb
CHANGED
@@ -6,6 +6,7 @@ module Codebreaker
|
|
6
6
|
attr_reader :difficulty, :errors, :secret_code, :result, :hints, :attempts_total, :hint_keeper,
|
7
7
|
:attempts_used, :attempts_available, :hints_total, :hints_used, :hints_available
|
8
8
|
|
9
|
+
TIME_FORMAT = '%d %b %Y - %H:%M:%S'
|
9
10
|
CODE_DIGITS = (1..6).freeze
|
10
11
|
CODE_LENGTH = 4
|
11
12
|
MATCH = '+'
|
@@ -42,6 +43,8 @@ module Codebreaker
|
|
42
43
|
def start
|
43
44
|
@code = @secret_code.dup
|
44
45
|
@attempts -= 1
|
46
|
+
attempts_calculations
|
47
|
+
hints_calculations
|
45
48
|
matches_result = check_matches
|
46
49
|
presence_result = check_presence
|
47
50
|
@result = (matches_result + presence_result).join
|
@@ -92,7 +95,8 @@ module Codebreaker
|
|
92
95
|
attempts_total: LEVELS.dig(@difficulty.to_sym, :attempts),
|
93
96
|
attempts_used: LEVELS.dig(@difficulty.to_sym, :attempts) - @attempts,
|
94
97
|
hints_total: LEVELS.dig(@difficulty.to_sym, :hints),
|
95
|
-
hints_used: LEVELS.dig(@difficulty.to_sym, :hints) - @hints.size
|
98
|
+
hints_used: LEVELS.dig(@difficulty.to_sym, :hints) - @hints.size,
|
99
|
+
time: Time.now.strftime(TIME_FORMAT)
|
96
100
|
}
|
97
101
|
end
|
98
102
|
|
data/lib/codebreaker/version.rb
CHANGED