No code (yet), just a try at an algorithm for a solution. - for each of the "hint" words:
- delete all duplicate letters.
- make a list of all possible combinations of letters allowed (eg: for "bumps/2" -> bu bm bp bs um up us mp ms ps)
- for each of these lists of allowed letters, make all possible combinations of one item from each list (again discarding any duplicate letters in the result) which is not longer than the length of the mystery word (smaller is OK, in which case you can later "duplicate" one of the letters to "fill the gap"). Check the result with the requirements of each "hint" word (reason: by adding letters from different hint words, you may break the requirement of one of them). Put words which pass this test on a "results" list.
- Go through the results list (expanding words with too few letters by duplicating, triplicating, ... existing letters to fill the gaps), sort the letters and check against a dictionary of English words (preferably some sort of "inverted" dictionary with words with their letters already sorted). Put words which pass this test on a "final results list".
- Finished!
CountZero "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
-
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.
|