I'm always tinkering with Scrabble-like puzzles, and writing scripts to help me solve them.

One basic need is to filter my dictionary file to remove impossible words (or find impossible words), based on the number of tiles for each letter. Assume whatever dictionary structure you like, as well as the tile count list or structure of your choice. Assume blank tiles are a non-alpha character, such as '#'.

Challenge 1: Ignoring blank tiles, write a code snippet to efficiently match possible (or impossible) words in the dictionary.

Challenge 2: Modify #1 for blank tiles.

Bonus Challenge 3: Design a dictionary structure that enables efficient searches for puzzles, while minimizing space. For example, I have 5 tiles in @my_tiles, a given board partial row @this_row, which will have at least 1 tile placed, and possibly more, along with at least 1 blank space. The dictionary structure should make it easy to find all words that will fit in this partial row, using tiles from @my_tiles.

-QM
--
Quantum Mechanics: The dreams stuff is made of


In reply to Scrabble Word Regex Challenge by QM

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.