Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 18:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found