lib/codebreaker/game.rb in sarcasm-codebreaker-0.2.7 vs lib/codebreaker/game.rb in sarcasm-codebreaker-0.2.8
- old
+ new
@@ -32,10 +32,11 @@
def restart
start(@settings)
end
def guess(code)
- fail IndexError if code.length != @secret.length
+ fail IndexError if code.length != @secret.length
+ fail ArgumentError unless code.all? { |x| (1..@symbols_range).include?(x) }
if code == @secret
win
else
@attempts -= 1