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'
};
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.