Skip to content

Commit

Permalink
Made error check more generic, == 0 doesn't catch negative numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Hamilton committed Nov 7, 2011
1 parent 8c38cd2 commit 60d2928
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ def initialize
begin
puts "Please enter the number of human players you wish to play (1 or 2)"
count = (gets).to_i
if count == 0 || count > 2
if count < 1 || count > 2
puts "Not a valid input. Please try again"
next
end
end while count == 0 || count > 2
end while count < 1 || count > 2

@players << HumanPlayer.new(Player::BLACK)
if count == 1:
Expand Down

0 comments on commit 60d2928

Please sign in to comment.