Class: PangrammicSurplus

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

Defined Under Namespace

Classes: MinimalCount, Vector, WordHash

Class Method Summary collapse

Class Method Details

.for(input, allow_negatives = false) ⇒ Object



4
5
6
7
8
9
# File 'lib/pangrammic_surplus/base.rb', line 4

def for(input, allow_negatives = false)
  minimal = MinimalCount.for(input)
  surplus = Vector.subtract(input, minimal)

  (allow_negatives || satisfiable?(surplus)) ? surplus : nil
end