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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 435767b1df359b965f3d3b0f93311d24f1662ceea9d2bf092bc29f16d56681ee
4
- data.tar.gz: a9894cacc72c053cf47cc7b1cff2271a2bc697e2b03918c68c12a8fe75638e30
3
+ metadata.gz: e939f4dbfde225f7704f87b6446a43d99c23c68bde623002b89f71c41c0d7b34
4
+ data.tar.gz: 66c37dfbee641cad5eb61257aa39c5a930cb73bcb4d22a8a873db95b2491f3d3
5
5
  SHA512:
6
- metadata.gz: c0b4be341a2262844dac9c8167ce2b9c1e2c31df650b3e63597905564de327a8f6b63abbe7f63cd507ff1e852e5927ffeb4236b3145ef13cc615d3c180cebf37
7
- data.tar.gz: 583414aa304ced16afebae113d9c0b4f18ca00680ec509970a11762b661c9a71018da69dea0fd7fdb2d63682d5098be568e7de4cc1b8f228f2770b081ddce360
6
+ metadata.gz: fc2e54e5b4d281684ef89f39ed88889fa8ed9f256f35b892b380e840ca600c6282c6482df9e94758d47a7780a32f237dd5a542c6a8ed1a374e197b4aea5762af
7
+ data.tar.gz: 2d4d14b053ffdb3b28c11cb7aab709bd2ad02f8d92fe85ab8e07840241f8f78a2683ef29852574fdd8995a4e1b8c453ef09903c49c29ddbbf6828894569ca5c0
@@ -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
@@ -0,0 +1,13 @@
1
+ module Codebreaker
2
+ module Motivation
3
+ private
4
+ def message_is_allowed?
5
+ !game.won? && game.attempts == rand(1..game.configuration.max_attempts)
6
+ end
7
+
8
+ def motivation_message(msg)
9
+ return unless message_is_allowed?
10
+ msg
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Codebreaker
2
- VERSION = '0.3.1.0'
2
+ VERSION = '0.3.2.0'
3
3
  end
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.1.0
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-18 00:00:00.000000000 Z
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