Class: Binary_Puzzle_Solver::BaseClass

Inherits:
Object
  • Object
show all
Defined in:
lib/binary_puzzle_solver/base.rb

Direct Known Subclasses

Board, RowHandle

Instance Method Summary collapse

Instance Method Details

#opposite_value(val) ⇒ Object



170
171
172
173
174
175
176
177
178
# File 'lib/binary_puzzle_solver/base.rb', line 170

def opposite_value(val)
    if (val == Cell::ZERO)
        return Cell::ONE
    elsif (val == Cell::ONE)
        return Cell::ZERO
    else
        raise RuntimeError, "'#{val}' must be zero or one."
    end
end