mastermind-nowsiany 1.0.2 → 1.0.3

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
  SHA1:
3
- metadata.gz: bf410ef9127e628bb4d035ba3122d50dc15c05cc
4
- data.tar.gz: 8a75801e1b0da4d76a47778530946f81145d2a47
3
+ metadata.gz: 02428df68b8b32df5b96ed1ca7e6ac5a25245e82
4
+ data.tar.gz: 3838e45723eec4dcb7b7a52a567ac6662b6e5ae6
5
5
  SHA512:
6
- metadata.gz: 74352089cefe463b797308e0bb3adc6694d5204205e380aee2e4c2ca339f9857f49452e38da6e13a97768dd309bbbf97ae494977c8c246b0cd029d6b2b32fab6
7
- data.tar.gz: e5165cf3d0300d0792a9d75c048b3c1247aced495c59a4143270ec2022b2fab9f2d5e68c8ede6b0ad4fadc930e3718878aceb477683d816c456f493caad5f59e
6
+ metadata.gz: ca24601bdb39d7f5912e6ada12d91a602a592e3bededf61ef00b561b10d2e7e67c5ca4fd0335b8e209de50373c3075034cd7d46728a7d11a88d0d8b3165fd5c5
7
+ data.tar.gz: 984f806a4e17c6a6187a4f65cc6a2eca70f110b4583006ca6c186d8827ebe09856d2324d0b9d946a63fe05be20ed68490367952c70eafc32a62e300381842dc4
@@ -91,7 +91,7 @@ module Mastermind
91
91
  def process_command(player)
92
92
  case
93
93
  when quit?(player) then quit_confirm(player)
94
- when !valid_guess?(player.command, player.secret, valid_colors) then outstream.puts interact.print_invalid_guess(player.command)
94
+ when !valid_guess?(player.command, player.secret, valid_colors) then outstream.puts interact.print_invalid_guess(player)
95
95
  when valid_guess?(player.command, player.secret, valid_colors) then guess(player)
96
96
  end
97
97
  end
@@ -191,8 +191,16 @@ Enter your guess in the form of '#{color_guess("RGBY")}':
191
191
  Are you sure you want to quit? (y)es/(n)o".colorize(:red)
192
192
  end
193
193
 
194
- def print_invalid_guess(invalid_command)
195
- "'#{invalid_command}' is not a valid guess, please guess again."
194
+ def print_invalid_guess(player)
195
+ if player.turn_pos == 0
196
+ "\n"+
197
+ "'#{player.command}' is not a valid guess,\n"+
198
+ "please guess again."
199
+ else
200
+ "\n"+
201
+ " '#{player.command}' is not a valid guess,\n"+
202
+ " please guess again."
203
+ end
196
204
  end
197
205
 
198
206
  def print_guess_stats(number_guesses, correct_pos, correct_color, guess, max_guesses, player)
@@ -1,3 +1,3 @@
1
1
  module Mastermind
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
data/spec/cli_spec.rb CHANGED
@@ -24,7 +24,7 @@ RSpec.describe Mastermind::CLI do
24
24
  cli = Mastermind::CLI.new(stdin, stdout)
25
25
  cli.run
26
26
  expect(stdout.string).to include("0;32;49m")
27
- expect(stdout.string).to include("MA1N")
27
+ expect(stdout.string).to include("MAIN")
28
28
  expect(stdout.string).to include("_/")
29
29
  end
30
30
 
@@ -1,4 +1,5 @@
1
1
  require 'mastermind/interact'
2
+ require 'mastermind/player'
2
3
 
3
4
  RSpec.describe Mastermind::Interact do
4
5
  before do
@@ -29,9 +30,8 @@ RSpec.describe Mastermind::Interact do
29
30
  end
30
31
 
31
32
  it 'prints an invalid guess message' do
32
- invalid_cmd = "XXXX"
33
- expect(@interact.print_invalid_guess(invalid_cmd)).to include("not a valid")
34
- expect(@interact.print_invalid_guess(invalid_cmd)).to include(invalid_cmd)
33
+ player = Mastermind::Player.new("Steve")
34
+ expect(@interact.print_invalid_guess(player)).to include("not a valid")
35
35
  end
36
36
 
37
37
  end
@@ -27,7 +27,7 @@ RSpec.describe Mastermind::PlayGame do
27
27
  interact = Mastermind::Interact.new
28
28
  game = Mastermind::PlayGame.new(stdin, stdout, interact)
29
29
  game.run
30
- expect(stdout.string).to include("(s)1nG1e")
30
+ expect(stdout.string).to include("(s)ingle")
31
31
  end
32
32
 
33
33
  it "should generate the specified number of players" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mastermind-nowsiany
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Owsiany