lib/codebreaker/guess_checker.rb in codebreaker_kub-0.3.1 vs lib/codebreaker/guess_checker.rb in codebreaker_kub-0.3.2
- old
+ new
@@ -19,11 +19,12 @@
@none = none
end
def check_input
raw_result = mismatched
- matched(raw_result)
+ matched_result = matched(raw_result)
+ check_result(matched_result)
end
private
def mismatched
@@ -36,8 +37,14 @@
result.sub!(@inexact, @exact) if element == @code[index]
end
return result unless result.empty?
@none
+ end
+
+ def check_result(result)
+ result = result.chars
+ result = result << @none until result.size == 4
+ result.join
end
end
end