lib/number-placement.rb
def candidates(x, y)
      f = Hash.new
      Values.each do |v|
        f[v] = @neighbors[[x,y]].map{|n|
          cs = n.placeable(v, self)
          if cs.include?([x,y])
            cs.size
          else
            0
          end
        }.min
      end
      return f
    end
# Hash: v => number of cells value can be placed
v => number of cells value can be placed
v = > number of cells value can be placed
def candidates(x, y)
      f = Hash.new
      Values.each do |v|
        f[v] = @neighbors[[x,y]].map{|n|
          cs = n.placeable(v, self)
          if cs.include?([x,y])
            cs.size
          else
            0
          end
        }.min
      end
      return f
    end
def candidates ( x , y ) f = Hash . new Values . each do | v | f [ v ] = @neighbors [ [ x , y ] ] . map { | n | cs = n . placeable ( v , self ) if cs . include? ( [ x , y ] ) cs . size else 0 end } . min end return f end
Hash: v => number of cells value can be placed
Hash : v = > number of cells value can be placed
x
y