JRowe Posted October 18, 2009 Share Posted October 18, 2009 (edited) I wrote/wrapped this up last year, and it's geared to evaluate a 5, 6, or 7 card hand, meaning it can tell you, given 7 cards, what the best 5 card hand you can make from the cards, how strong that hand is within it's own category (such as, 4 of a kind sixes will beat four of a kind fives.)It's based on the Two+Two forum brilliance, using a hash table (a 123 mb table of every possible 5, 6, and 7 card hand.)http://www.codingthewheel.com/archives/poker-hand-evaluator-roundup#2p2This is fast. It can evaluate 1 million hands in 28 seconds, ymmv.There are 4 functions:LoadHRDat() AnalyzeHand($iCardOne, $iCardTwo, $iCardThree, $iCardFour, $iCardFive, $iCardSix, $iCardSeven) AnalyzeHand6($iCardOne, $iCardTwo, $iCardThree, $iCardFour, $iCardFive, $iCardSix) AnalyzeHand5($iCardOne, $iCardTwo, $iCardThree, $iCardFour, $iCardFive)You need to have the HandRanks.dat file in your script directory, LoadHRDat() expects to find it there. I could make it more user friendly, but I'm not sure why it would ever need that, at this point. The functions return a hash value.$HandCategory = BitShift($Analysis, 12) $HandRankWithinCategory = BitAND($Analysis, 0x00000FFF)You need to perform a BitShift($return, 12) to get the hand category.You need to perform a BitAND($return, 0x00000FFF) to get the hand rank within that category.There are 9 categories. 1 is the lowest ranking, the highest rank depends on the category.A hand that tells you it is category 4, rank 858, means you've got 3 aces, a King, and a Queen, the best possible 3 of a kind. Rank 1 would be 3 deuces, a three, and a four.I have some helper code packaged up to interpret the information to english, these are _CardList.au3, _HandCategories.au3, and _HandStrength.au3. These denote the cards, the types of categories, and a normalized database of every 5 card hand (no variation.) They allow you to translate the results into english._HandEval.rarTo use: run XPokerEval.TwoPlusTwo.exe to create the HandRanks.dat database, then run RandomHandGenerator.au3 to generate random hands and see the results of evaluation.The hands database is important, without it the functions won't work. DealAHandOptimum() is a nice function if you want to generate your own random card hands.Or, download and unrar HandRanks.dat from here.And yes. Yes, I know. Edited October 22, 2009 by JRowe Geir1983 1 [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Horrendous Posted October 22, 2009 Share Posted October 22, 2009 Sorry to bother you. I have a problem. XPokerEval.TwoPlusTwo.exe crashed (Error executing program). HandRanks.dat has not been created. Does it work for WinXP? Link to comment Share on other sites More sharing options...
JRowe Posted October 22, 2009 Author Share Posted October 22, 2009 Aye, I built it on xp. I'll see what I missed. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
JRowe Posted October 22, 2009 Author Share Posted October 22, 2009 Updated the first post, here's what you need. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Horrendous Posted October 22, 2009 Share Posted October 22, 2009 Thank you for the upload. I feel quite dumb because i have another problem. Am i supposed to use newer version than 3.3.0.0? Or Am i missing any other #include? Thank you for you time. Link to comment Share on other sites More sharing options...
JRowe Posted October 22, 2009 Author Share Posted October 22, 2009 Did you download Handeval.rar?You need the plugin dll in the same directory as HandRanks.dat and the the demo script. Sorry I wasn't more explicit. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Horrendous Posted October 22, 2009 Share Posted October 22, 2009 Unfortunately, I have all parts in the same directory (Demo script,HandRanks.dat,handEval.dll). Link to comment Share on other sites More sharing options...
JRowe Posted October 22, 2009 Author Share Posted October 22, 2009 (edited) Sounds like an msvc runtime distributable issue. Lemme figure out which one you need and I'll link it. Here we be: Install this: http://www.microsoft.com/downloadS/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en Edited October 22, 2009 by JRowe [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Horrendous Posted October 22, 2009 Share Posted October 22, 2009 It still doesn't know LoadHRDat(). I am sorry to be annoying. Maybe i should give up this. Link to comment Share on other sites More sharing options...
JRowe Posted October 22, 2009 Author Share Posted October 22, 2009 Are you using 3.3.0.0? It looks as if the "#AutoIt3Wrapper_Plugin_Funcs= LoadHRDat, AnalyzeHand" is missing from RandomHandGenerator.au3, but I've double checked and its there. Sorry you're having issues, really not sure what they might be... are you running x64 AutoIt? What are your machine specs? [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Horrendous Posted October 22, 2009 Share Posted October 22, 2009 I am using AutoIt 3.3.0.0 (not x64) and WinXP SP3 (not 64), AMD Athlon Dual Core 64x2, 2.40GHz, 2GB RAM and so on.. I thought there is something wrong with #AutoIt3Wrapper_Plugin_Funcs too. But i didn't find out what it could be. There is no reason you should be sorry. It seems there is a problem between my monitor and my chair Link to comment Share on other sites More sharing options...
JRowe Posted October 22, 2009 Author Share Posted October 22, 2009 Ok, I recreated the error. The problem is the plugin dll not being in the correct location, or not being read from the correct location. Is handEval.dll in the same directory? Try replacing line 10 of RandomHandGenerator with this: $handEval = PluginOpen(@ScriptDir & "\handEval.dll") Or replacing it with the explicit path to the file. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Horrendous Posted October 22, 2009 Share Posted October 22, 2009 I tried, but it returns the same result. I also checked that there was no read-only things or so.. Link to comment Share on other sites More sharing options...
JRowe Posted October 22, 2009 Author Share Posted October 22, 2009 Are you using 7zip to unrar the file? If so, download winrar and unrar it with that. I've had file corruption errors before from 7zip that weren't immediately apparent. Vice versa too, I'm not bashing 7zip, it's just that there's sometimes issues with using one program on a file compressed by the other. Something is screwing up the handEval.dll . Since it's not the redistributable, the OS, or the AutoIt version, I'm guessing it's the download and/or the uncompression. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Horrendous Posted October 23, 2009 Share Posted October 23, 2009 I am using winrar. I must admit I have never worked with 7zip. Link to comment Share on other sites More sharing options...
JRowe Posted October 23, 2009 Author Share Posted October 23, 2009 Only thing I can recommend is to compile it yourself. Sometime in the next week, I'll upload the source code for the plugin and link to the source for xPokerEval. If you haven't already, download the express edition of Visual C++ from Microsoft. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Horrendous Posted October 23, 2009 Share Posted October 23, 2009 Nice. Thank you! Link to comment Share on other sites More sharing options...
tito Posted June 13, 2010 Share Posted June 13, 2010 any news on this topic ? I'd love to try this out but I get the same errors... Link to comment Share on other sites More sharing options...
pierrotm777 Posted June 14, 2010 Share Posted June 14, 2010 any news on this topic ?I'd love to try this out but I get the same errors...The link for the HandRanks.dat file is bad.Do you have another ?Thanks Link to comment Share on other sites More sharing options...
JRowe Posted August 10, 2010 Author Share Posted August 10, 2010 Use _XPokerEval.twoplustwo.exe to generate the HandRanks.dat file on your system. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now