lib/game.rb in edlvj_codebreaker-0.1.0 vs lib/game.rb in edlvj_codebreaker-0.2.0

- old
+ new

@@ -17,10 +17,11 @@ end def match_guess(code) return "Your code is not valid" unless code.match(/(^([1-6]{4})$)/) + @win_status = true if @secret_code == code @attempts -= 1 secret = @secret_code.chars.map(&:to_i) res = [] code.chars.map(&:to_i).each_with_index do |number, index| @@ -29,12 +30,11 @@ res << PROPER elsif secret.include? number secret[secret.find_index(number)] = nil res << WRONG_POSITION end - end - - @win_status = true if res.join == '++++' + end + res.join end def loose? @attempts == 0 \ No newline at end of file