lib/combinatorial_puzzle_solver/possibilities.rb
# Reduce the possible values by stating that the identifier cannot have a certain
# value.
#
# @param value [Object] a value that the identifier cannot have.
# @param resolvable [Hash<Identifier,Object>] an optional Hash to store all
#                                             identifiers and values that becomes
#                                             resolvable.
# @return [Hash<Identifier,Object>] the hash of identifiers that becomes
#                                   resolvable because of this action.
# @raise [Inconsistency] if the solution space becomes inconsistent without any
#                        possible solution.
Reduce the possible values by stating that the identifier cannot have a certain
value.
Reduce the possible values by stating that the identifier cannot have a certain value .
def cannot_be!(value, resolvable=Hash.new)
      raise Inconsistency if @identifier.value == value
      if delete(value) then
        raise Inconsistency if empty?
        resolvable[@identifier] = first if resolved?
      end
      resolvable
    end
def cannot_be! ( value , resolvable = Hash . new ) raise Inconsistency if @identifier . value == value if delete ( value ) then raise Inconsistency if empty? resolvable [ @identifier ] = first if resolved? end resolvable end
Reduce the possible values by stating that the identifier cannot have a certain
value.
Reduce the possible values by stating that the identifier cannot have a certain value .
the hash of identifiers that becomes resolvable because of this action.
the hash of identifiers that becomes resolvable because of this action .
Hash<Identifier,Object>
[Inconsistency] if the solution space becomes inconsistent without any possible solution.
[ Inconsistency ] if the solution space becomes inconsistent without any possible solution .
value
a value that the identifier cannot have.
a value that the identifier cannot have .
resolvable
an optional Hash to store all identifiers and values that becomes resolvable.
an optional Hash to store all identifiers and values that becomes resolvable .
new
<not_specific>