Class: Codebreaker::GuessChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/codebreaker/guess_checker.rb

Constant Summary collapse

MINUSE =
'-'
PLUS =
'+'
NONE =
' '

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, code_input) ⇒ GuessChecker

Returns a new instance of GuessChecker.



11
12
13
14
# File 'lib/codebreaker/guess_checker.rb', line 11

def initialize(code, code_input)
  @code = code.chars
  @code_input = code_input.chars
end

Instance Attribute Details

#exactObject

Returns the value of attribute exact.



5
6
7
# File 'lib/codebreaker/guess_checker.rb', line 5

def exact
  @exact
end

#inexactObject

Returns the value of attribute inexact.



5
6
7
# File 'lib/codebreaker/guess_checker.rb', line 5

def inexact
  @inexact
end

#noneObject

Returns the value of attribute none.



5
6
7
# File 'lib/codebreaker/guess_checker.rb', line 5

def none
  @none
end

Instance Method Details

#check_inputObject



22
23
24
25
26
# File 'lib/codebreaker/guess_checker.rb', line 22

def check_input
  raw_result = mismatched
  matched_result = matched(raw_result)
  check_result(matched_result)
end

#symbols(inexact = MINUSE, exact = PLUS, none = NONE) ⇒ Object



16
17
18
19
20
# File 'lib/codebreaker/guess_checker.rb', line 16

def symbols(inexact = MINUSE, exact = PLUS, none = NONE)
  @inexact = inexact
  @exact = exact
  @none = none
end