I've found a few problems with my solution (failure to handle anagrams is one), but it does the right thing in many cases. Here is some test data I've generated--solutions are all animals on some nearby books.
$length = 6;
$hints = {
'blackly' => '2',
'drowsy' => '1',
'Haddad' => '1',
'desperado' => '2',
'achieving' => '2',
'cowls' => '1',
'bet' => '1',
'comprehension' => '2',
'foe' => '1',
'permeate' => '1',
'Balkanizations' => '4'
};
$length = 7;
$hints = {
'shortest' => '3',
'drilling' => '0',
'locked' => '2',
'messing' => '1',
'irritated' => '1',
'glory' => '1',
'modes' => '2',
'transcribed' => '3'
};
$length = 5;
$hints = {
'blocker' => '2',
'entropy' => '2',
'monotonously' => '4',
'resonant' => '3',
'blindfold' => '1',
'decrypts' => '2',
'inquiry' => '1',
'considered' => '3'
};
And a trickier one...
$length = 5;
$hints = {
'repartee' => '1',
'Kankakee' => '2',
'dewdrop' => '0',
'brushfires' => '2',
'identifiably' => '4',
'liberalizes' => '4',
'swimming' => '3',
'Geoffrey' => '0',
'dotting' => '2'
};
|