All,
Tanktalus presented an interesting puzzle at Challenge: Letter Power. Given a number of categories, choose a unique word that fits each category to yield the highest score possible. Each letter used is worth 1 point the first time it is encountered, 2 points the second etc in a progressive fashion. In other words, if there were only two categories and you chose "moose" and "mother", the total score would be 16.

In the example presented by Tanktalus, the candidate word list to choose from had already been tailored to favor a high density of the letter a. I wondered what would happen if you were to generalize the problem. We both agreed that it would be too difficult to expect a computer to find words appropriate to fit a random category so instead, I have chosen to choose words at random.

I have already explored a number of heuristic approaches for making a "best guess", refinement algorithms to improve a "best guess" and a naive brute force implementation in C to perform an exhaustive search to produce the guaranteed optimal solution. I will present all of that in replies to this main thread for those looking for inspiration or validation.

Challenge:

Develop a pure perl solution that, in roughly 60 seconds, will provide a high scoring solution to a given puzzle. I will be providing a number of canned puzzles with the known best solution as well as code you can use to generate your own. There is no penalty for prep work behind the scenes so if you have some ingenious idea to construct a database of solutions or what not - by all means. Just keep in mind that the presented solution must be pure perl and finish within roughly 60 seconds.

Note: I will be adding my own contributions later today but most of my ideas have already been discussed over in the original challenge.

Cheers - L~R


In reply to Challenge: Letter Power Revisited by Limbic~Region

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.