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'
};
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.