codebreaker_kirill 0.2.20 → 0.3.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3f6ed248059b392d1c1f939faa4c76261e309db02dc5cec24bf76150615c388
|
4
|
+
data.tar.gz: 4693fb4f735da3bf31dbb6f7d9367162252197ee6e0d6c9d5a194b875016c112
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ae118680b9e3ce2533aca51ca87a9d05c330cdad3e8679a7342309d9a98f44a59d6e5a5f3beb78a80d9896121dc2051cbf53fa92514ff59829668df0abf2115
|
7
|
+
data.tar.gz: b39edda7c5b41000c1a2a1d19cb6df6324ff66af93e44f52142e40637b9fae908b1b8868e32cebd333b4545366b7680e1f89b1b04bb72ab27f372ff34b7cae54
|
@@ -5,7 +5,7 @@ require_relative 'game'
|
|
5
5
|
|
6
6
|
class GuessHandler
|
7
7
|
def respond_to_guess(game, input, code)
|
8
|
-
|
8
|
+
validation(input)
|
9
9
|
return game.give_a_hint if input == 'hint'
|
10
10
|
|
11
11
|
@result = []
|
@@ -41,4 +41,13 @@ class GuessHandler
|
|
41
41
|
end.sort
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def validation(input)
|
48
|
+
Validations.validate_guess(input)
|
49
|
+
rescue StandardError => e
|
50
|
+
puts e.message
|
51
|
+
nil
|
52
|
+
end
|
44
53
|
end
|
@@ -7,11 +7,18 @@ class User
|
|
7
7
|
attr_reader :name, :difficulty, :attempts, :hints
|
8
8
|
|
9
9
|
def initialize(name, difficulty)
|
10
|
-
|
11
|
-
Validations.validate_difficulty(difficulty)
|
10
|
+
validation(name, difficulty)
|
12
11
|
@name = name
|
13
12
|
@difficulty = Settings::DIFFICULTY[difficulty]
|
14
13
|
@attempts = { all: @difficulty[:attempts], used: 0 }
|
15
14
|
@hints = { all: @difficulty[:hints], used: 0 }
|
16
15
|
end
|
16
|
+
|
17
|
+
def validation(_input)
|
18
|
+
Validations.validate_name(name)
|
19
|
+
Validations.validate_difficulty(difficulty)
|
20
|
+
rescue StandardError => e
|
21
|
+
puts e.message
|
22
|
+
nil
|
23
|
+
end
|
17
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codebreaker_kirill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Dudchenko
|
@@ -32,7 +32,6 @@ files:
|
|
32
32
|
- lib/codebreaker_kirill/guess_handler.rb
|
33
33
|
- lib/codebreaker_kirill/settings.rb
|
34
34
|
- lib/codebreaker_kirill/stats.rb
|
35
|
-
- lib/codebreaker_kirill/stats.yml
|
36
35
|
- lib/codebreaker_kirill/user.rb
|
37
36
|
- lib/codebreaker_kirill/validations.rb
|
38
37
|
- lib/codebreaker_kirill/version.rb
|
@@ -1,34 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/object:User
|
3
|
-
name: dima
|
4
|
-
difficulty:
|
5
|
-
:attempts: 10
|
6
|
-
:hints: 1
|
7
|
-
attempts:
|
8
|
-
:all: 10
|
9
|
-
:used: 0
|
10
|
-
hints:
|
11
|
-
:all: 1
|
12
|
-
:used: 0
|
13
|
-
- !ruby/object:User
|
14
|
-
name: stacy
|
15
|
-
difficulty:
|
16
|
-
:attempts: 5
|
17
|
-
:hints: 1
|
18
|
-
attempts:
|
19
|
-
:all: 5
|
20
|
-
:used: 0
|
21
|
-
hints:
|
22
|
-
:all: 1
|
23
|
-
:used: 0
|
24
|
-
- !ruby/object:User
|
25
|
-
name: kirill
|
26
|
-
difficulty:
|
27
|
-
:attempts: 5
|
28
|
-
:hints: 1
|
29
|
-
attempts:
|
30
|
-
:all: 5
|
31
|
-
:used: 0
|
32
|
-
hints:
|
33
|
-
:all: 1
|
34
|
-
:used: 0
|