I am still not "getting it" in terms of your input syntax and how it should match against the dictionary.

I recently wrote a "cheater program" for a less sophisticated game, but perhaps with some similar matching requirements?

In my game, I have a set of "tiles", letters than I can use to form words. I cannot use any letter other than one of these letters to form words. There are not any 2 letter words in my dictionary. Your dictionary has a lot of weird words, but I guess that is how scrabble is!

Your example is a bit hard for me to figure out since, es,os,sh,si are not "normal English words" although as,is,so are. Likewise "aa" is not a normal English word, although "as" is. There are words in the scrabble dictionary that I've never read, heard or used.

What I'd like to see is a user session that shows how your scrabble cheat game works. I will attach a user example from my cheat program for another game. Once we understand what the code is supposed to do, then at least I would be interested in helping you create a "blackbelt" level cheat program - just for the fun of it!

Here is an example of the kind of example that I want from you:

Example 1: leading ";" means this is a list of letters instead of a pattern list of letters or pattern: ;lolewf list of letters or pattern: --- The --- says: show me all 3 letter words that can be formed from my letter "universe". elf ell few foe fol low owe owl woe # Example 2: # Show me all 4 letter words which can be formed from # the "list of letters" that have "l" as the 3rd letter list of letters or pattern: ;odlswe # List of Letters list of letters or pattern: --l- # A search pattern dole owls sold sole weld wold
I don't know really anything about Scrabble. But I think you will have to develop a syntax to input words that are on the board already. I think if some guy plays "pagan", you can play "ize" to turn this into "paganize" and score big points. In addition, each letter has some kind of "value", playing a "z" is worth more than playing an "a". I suspect that you are going to want a word sort order that instead of being alphabetical, is based upon the point value of the word?

I think your tr statement could be better:
tr is a very stupid thing and it does not use character sets. I am not sure why your code seems to work.

use strict; use warnings; my $string = '\abCD'; $string =~ tr/\[A-Z]/[a-z]/; #should be tr/A-Z/a-z/? print "$string\n";

In reply to Re^4: Problem with regex wildcard operator (.)...? by Marshall
in thread Problem with regex wildcard operator (.)...? by sbrothy

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.