andrii_codebreaker 0.1.7 → 0.1.8
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 +4 -4
- data/lib/andrii_codebreaker/game.rb +4 -3
- data/lib/andrii_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: 1a01bba68d09ade8b529e4f4ced95cdbcb32a89d6dc2dc38a9b3f4f89d9bcad6
|
4
|
+
data.tar.gz: b19b78984073b7017509da2df5159bcc422ff6359432a88257e84a517369e95b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b51935c0eb2382f41d9fb8c6859d507eaf7cf21ca7aad9a9f386262ad9b95130af5fdceab79ee424a7b906c934a906bf9358e49316b73e588aebadd5b613939f
|
7
|
+
data.tar.gz: 594d24a0cd286e63d0b6ab241080d629d4b2bc9bbc5648b57cdae0e159997381587ed7e90c1063e6bd5cc75ab99e6449bbff638e70c2b9c0a43b01bff354d15c
|
@@ -5,7 +5,7 @@ module AndriiCodebreaker
|
|
5
5
|
include Statistic
|
6
6
|
include Constant
|
7
7
|
|
8
|
-
attr_reader :player_name, :difficulties, :attempts_total, :hints_total, :secret_code
|
8
|
+
attr_reader :player_name, :difficulties, :attempts_total, :hints_total, :secret_code, :difficulty
|
9
9
|
attr_accessor :hints_left, :attempts_left, :secret_code_copy
|
10
10
|
|
11
11
|
CONST_COMMAND = {
|
@@ -27,6 +27,7 @@ module AndriiCodebreaker
|
|
27
27
|
@secret_code_copy = @secret_code.chars
|
28
28
|
@hints_total = @difficulties.hint
|
29
29
|
@attempts_total = @difficulties.attempts
|
30
|
+
@difficulty = @difficulties.difficulty
|
30
31
|
end
|
31
32
|
|
32
33
|
def hints
|
@@ -60,7 +61,7 @@ module AndriiCodebreaker
|
|
60
61
|
|
61
62
|
code_guess.each_index do |i|
|
62
63
|
if code_guess[i] == secret_code[i]
|
63
|
-
result +=
|
64
|
+
result += PLUS
|
64
65
|
index << i
|
65
66
|
end
|
66
67
|
end
|
@@ -72,7 +73,7 @@ module AndriiCodebreaker
|
|
72
73
|
code_guess.each do |i|
|
73
74
|
next unless secret_code.include?(i)
|
74
75
|
|
75
|
-
result
|
76
|
+
result += MINUS
|
76
77
|
index = secret_code.index(i)
|
77
78
|
secret_code.delete_at(index)
|
78
79
|
end
|