lib/combinatorial_puzzle_solver/possibilities.rb
# Reduce the possible values by stating that the identifier can only have a
# certain value.
#
# @param value [Object] the only possible value the identifier can have.
# @param resolvable [Hash<Identifier,Object>] an optional Hash to store all
#                                             identifiers and values that becomes
#                                             resolvable.
# @return [Hash<Identifier,Object>] a 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 can only have a
certain value.
Reduce the possible values by stating that the identifier can only have a certain value .
def must_be!(value, resolvable=Hash.new)
      raise Inconsistency if @identifier.has_value? && @identifier.value != value
      raise Inconsistency unless include?(value)
      clear
      push(value)
      dependent_identifiers_cannot_be!(value, resolvable)
    end
def must_be! ( value , resolvable = Hash . new ) raise Inconsistency if @identifier . has_value? && @identifier . value != value raise Inconsistency unless include? ( value ) clear push ( value ) dependent_identifiers_cannot_be! ( value , resolvable ) end
Reduce the possible values by stating that the identifier can only have a
certain value.
Reduce the possible values by stating that the identifier can only have a certain value .
a Hash of identifiers that becomes resolvable because of this action.
a 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
the only possible value the identifier can have.
the only possible value the identifier can 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>