Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: regex for word puzzle

by muba (Priest)
on Jun 13, 2005 at 00:49 UTC ( [id://466017]=note: print w/replies, xml ) Need Help??


in reply to regex for word puzzle

What thou needest, fellow monk who shall rename unnamed and anonymous, shall be not a regular expression.

No, instead you'll need some kind of a loop construct.
I don't know how good your math is, but with a word of 9 letters, there are 9! = 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 combination. This is because at the first position there are nine possible letters. The second position has only 8 possible letters and so on.

Your task will be to write a loop than can create all these combinations. And regex won't do that for you, AFAIK.




"2b"||!"2b";$$_="the question"
Besides that, my code is untested unless stated otherwise.
One more: please review the article about regular expressions (do's and don'ts) I'm working on.

magnum unum bovem audivisti

Replies are listed 'Best First'.
Re^2: regex for word puzzle
by monarch (Priest) on Jun 13, 2005 at 00:55 UTC
    I echo muba's comments above, and note that I have done a similar sort of program for yahoo word games and that kind of thing.

    I think it would be unfair to solve the problem for you.. because this is not a Perl programming issue so much (as muba pointed out with regard to using regexps to solve the problem) but more a program logic issue.

    I can assist with suggestions though. First you'll need to compile a dictionary of words into a format you can use for lookup. Secondly you'll need to convert the supplied word into something you can match against your compiled version of the english dictionary.

    If you're getting stuck, examine yourself. What thought processes do you use when attempting to solve such a puzzle? Are you scanning for letters? Are you comparing jumbled random bits to english words that you know? How do you solve it manually.. remember a computer usually can only do what we can do.. but faster and more consistently.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://466017]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-25 16:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found