Skip to content

Instantly share code, notes, and snippets.

@dougal
Created December 20, 2016 18:57
Show Gist options
  • Save dougal/e5b71cfa43321c2181f58bb11534bda7 to your computer and use it in GitHub Desktop.
Save dougal/e5b71cfa43321c2181f58bb11534bda7 to your computer and use it in GitHub Desktop.
#known = {'ponderous' => 2, 'poisoning' => 3} # companies
#known = {'setting' => 1} # devolve
#known = {'capacity' => 3} # creating
#known = {'merciless' => 1, 'completes' => 2, 'monitored' => 1 }
#known = {'rearguard' => 1, 'fortified' => 3, 'concerned' => 5} # conducted (guess of two)
#known = {'depending' => 3, 'decisions' => 2} # reprimand
known = {} # origins
def matches(word, other_word, number)
word = word.split(//)
other_word = other_word.split(//)
matches = 0
word.each_with_index do |c,i|
matches += 1 if c == other_word[i]
end
matches == number
end
#words = %w{poisoning conducted honorable poisoning confusing ponderous convinces concerned construct converted consisted pantheist companies conquorer contained monocolor ransacke southward}
#words = %w{aquire heavily dealing fencing defense fertile devolve beeping cochise despite setting}
#words = %w{creating pounding chastise maintain shooting reactions facility thrusting plotting tripping capacity downhill clothing pristine mourning oblivion planning}
#words = %w{convicted gentleman pantheist perimeter monitored consisted southeast torturing concealed ponderous collected continued doctrines convinces convinced northwest completes merciless}
#words = %w{rearguard fortified ransacked generated convinces convicted bloodshed wastelord concerned concealed resources reprimand untouched monoblade convinced continued conducted collected wasteland}
#words = %w{depending including decisions occupants determine arranging reprimand religions receiving obtaining beginning divisions undergone companies radiation qualities encounter returning}
words = %w{origins healing wearing carries trading persona sliding leading legions staying players reasons blowing playing happens reading heavily leaving sermons}
words = words - known.keys
words = words.find_all do |w|
known.each do |k,v|
bool = matches(k,w,v)
break if bool == false
end
end
if known.size == 0
words.each do |w|
puts w.length.to_s + ' ' + w
end
end
puts words.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment