http://www.perlmonks.org?node_id=198591


in reply to Re: Pattern Matching Query
in thread Pattern Matching Query

Hi Lexicon,

Interesting stuff - I wish I'd searched PM before I started in on this! Although I probably would have written my version anyway as I have really improved my Perl over the past week or so.

One of the things that I noticed was that you can use a lot of cheats rather than look for the exact hand (mine only work for five cards though) - for example, if a unique list of the card values has only two elements then it must be either a full house or a four-of-a-kind. This reduces by a long way the amount of work to be done. I've also realised that I can rank the hand using the standard gt, lt and eq operators because of the way I set out how the hand's score is formatted.

The version I'm working on at the moment uses an object oriented (something I'm trying to get a handle on) interface to handle the card-related functions: Shuffling, dealing, flopping, turn, river and who wins. I've also added a sethand function so that it can be used for basic statistical analyses. The next thing for me to write is an overlying game & betting manager so that it can be used as the basis for some kind of AI Poker competition or game.

Thanks, Elgon

"What this book tells me is that goose-stepping morons, such as yourself, should read books instead of burning them."
       - Dr. Jones Snr, Indiana Jones and the Last Crusade