Class: CodebreakerDiz::Matcher
- Inherits:
-
Object
- Object
- CodebreakerDiz::Matcher
- Defined in:
- lib/codebreaker_diz/matcher.rb
Instance Method Summary collapse
-
#initialize(secret_code, user_code) ⇒ Matcher
constructor
A new instance of Matcher.
- #matches ⇒ Object
Constructor Details
#initialize(secret_code, user_code) ⇒ Matcher
7 8 9 10 11 12 13 |
# File 'lib/codebreaker_diz/matcher.rb', line 7 def initialize(secret_code, user_code) @secret_code = secret_code.clone @user_code = user_code @exact_matches = 0 @number_matches = 0 end |
Instance Method Details
#matches ⇒ Object
15 16 17 18 19 |
# File 'lib/codebreaker_diz/matcher.rb', line 15 def matches calculate_matches EXACT_MATCH_SIGN * @exact_matches << NUMBER_MATCH_SIGN * @number_matches end |