codebreaker2018 0.3.1.0 → 0.3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codebreaker/console.rb +2 -10
- data/lib/codebreaker/motivation.rb +13 -0
- data/lib/codebreaker/version.rb +1 -1
- data/lib/codebreaker.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e939f4dbfde225f7704f87b6446a43d99c23c68bde623002b89f71c41c0d7b34
|
4
|
+
data.tar.gz: 66c37dfbee641cad5eb61257aa39c5a930cb73bcb4d22a8a873db95b2491f3d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc2e54e5b4d281684ef89f39ed88889fa8ed9f256f35b892b380e840ca600c6282c6482df9e94758d47a7780a32f237dd5a542c6a8ed1a374e197b4aea5762af
|
7
|
+
data.tar.gz: 2d4d14b053ffdb3b28c11cb7aab709bd2ad02f8d92fe85ab8e07840241f8f78a2683ef29852574fdd8995a4e1b8c453ef09903c49c29ddbbf6828894569ca5c0
|
data/lib/codebreaker/console.rb
CHANGED
@@ -4,6 +4,7 @@ require 'erb'
|
|
4
4
|
module Codebreaker
|
5
5
|
class Console
|
6
6
|
include Message
|
7
|
+
include Motivation
|
7
8
|
include Storage
|
8
9
|
|
9
10
|
DEMO = Game.new('Demo User', 5, 2, :middle, :en)
|
@@ -74,19 +75,10 @@ module Codebreaker
|
|
74
75
|
input
|
75
76
|
end
|
76
77
|
|
77
|
-
def message_is_allowed?
|
78
|
-
!game.won? && game.attempts == rand(1..game.configuration.max_attempts)
|
79
|
-
end
|
80
|
-
|
81
|
-
def motivation_message
|
82
|
-
return unless message_is_allowed?
|
83
|
-
message['alerts']['motivation']
|
84
|
-
end
|
85
|
-
|
86
78
|
def process(input)
|
87
79
|
begin
|
88
80
|
puts game.to_guess(input)
|
89
|
-
puts motivation_message
|
81
|
+
puts motivation_message(message['alerts']['motivation'])
|
90
82
|
rescue => error
|
91
83
|
puts error
|
92
84
|
finish_game
|
data/lib/codebreaker/version.rb
CHANGED
data/lib/codebreaker.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative 'codebreaker/version'
|
2
2
|
require_relative 'codebreaker/localization'
|
3
3
|
require_relative 'codebreaker/message'
|
4
|
+
require_relative 'codebreaker/motivation'
|
4
5
|
require_relative 'codebreaker/storage'
|
5
6
|
require_relative 'codebreaker/game'
|
6
7
|
require_relative 'codebreaker/score'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codebreaker2018
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Trotsenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- lib/codebreaker/locale/game/ru-RU.yml
|
95
95
|
- lib/codebreaker/localization.rb
|
96
96
|
- lib/codebreaker/message.rb
|
97
|
+
- lib/codebreaker/motivation.rb
|
97
98
|
- lib/codebreaker/score.rb
|
98
99
|
- lib/codebreaker/storage.rb
|
99
100
|
- lib/codebreaker/version.rb
|