Class: Binary_Puzzle_Solver::Cell
- Inherits:
-
Object
- Object
- Binary_Puzzle_Solver::Cell
- Defined in:
- lib/binary_puzzle_solver/base.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Class Method Summary collapse
Instance Method Summary collapse
- #get_char ⇒ Object
-
#initialize(params = {}) ⇒ Cell
constructor
A new instance of Cell.
- #set_state(new_state) ⇒ Object
Constructor Details
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
60 61 62 |
# File 'lib/binary_puzzle_solver/base.rb', line 60 def state @state end |
Class Method Details
Instance Method Details
#get_char ⇒ Object
93 94 95 |
# File 'lib/binary_puzzle_solver/base.rb', line 93 def get_char() return Cell.get_state_char(state) end |
#set_state(new_state) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/binary_puzzle_solver/base.rb', line 71 def set_state (new_state) if (not VALID_STATES.has_key?(new_state)) raise RuntimeError, "Invalid state " + new_state.to_s; end if (@state != UNKNOWN) raise RuntimeError, "Cannot reassign a value to the already set state." end @state = new_state return end |