Jump to content

Poker Hand evaluator plugin


JRowe
 Share

Recommended Posts

I get error when using the _XPokerEval.twoplustwo.exe - Application failed to start because application configuration is incorrect.

XP SP2 32bit Ait 3.3.0.0

The download link is not working for me too. Please upload again.

Link to comment
Share on other sites

  • 4 months later...

can we revisit this issue - i had this working before, but now it appears that it cannot find, the function LoadHRDat().

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • 4 weeks later...

Hmmm now that I've spent >3h searching for it, I dare to ask if someone could tell me how or where I can get the handranks.dat.

My _XPokerEval.twoplustwo.exe seems to be damaged and I can't find it or the .dat file anywhere else... (And don't figure out how to build it on my own...)

PLEASE HELP!!!! :)

Link to comment
Share on other sites

The original post contains a link to the source article which inspired the whole thing.

http://www.codingthewheel.com/archives/poker-hand-evaluator-roundup#2p2

Reading that article should be a prerequisite to using this, anyway. You can get the pre-compiled binaries and the source from the links.

Link to comment
Share on other sites

Since you replied - can you provide a fix for -ERROR function LoadHRDat() not found?

The funny thing is, I know I had this working, and now have time to create a full game - well maybe time :)

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

after hours of annoyance (installing various c++ editors etc.), here we go! :)

XPokerEval.TwoPlusTwo.exe.zip (Rapidshare)

I am not sure you are replying to my post or not, but i have the DAT file it is the DLL that is having issues, or updated version of AutoIt, or because the function PluginOpen() is not supported? Not sure?

Here is the line in OP code: $handEval = PluginOpen("handEval.dll")

But like I said, I get and error about a function inside the dll that cannot be found.

Also, I am sorry, I will not be able to download your EXE. To see if it works, maybe someone else can and post the results.

EDIT - now you make mine thread obsolete lol.

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Probably something to do with a visual studio runtime. Even if its not a runtime issue, it's trivial to get it working from scratch. Besides, creating a normal dll and using dllCall makes more sense now than using plugins.

Link to comment
Share on other sites

Ah sorry nitekram, I didn't expect you to respond so quickly... ^^

However, it seems we are now pulling the same string...

@JRowe: What would you recommend me to do? What do you mean with creating it from the scratch?? As you might figure out, my programming skills are somehow limited and I've never created a .dll myself - hell, days ago I didn't even know what they are for... ^^ However, I'm willing to learn if I have to...

Edited by waldoo
Link to comment
Share on other sites

  • 2 years later...

Hi guys

I see alot of people having troubble getting this to work so I will share how i got it running. I also had troubble with generating the HandRanks.dat so after some googling i found a copy at Github.. When i finaly found it I got another error that is mentioned alot in this tread:

RandomHandGenerator.au3 (13) : ==> Unknown function name.:

$dat = LoadHRDat()

$dat = ^ ERROR

I tried installing alot of the visual studio 2008 c++ (and others) redistributables without any luck. However i decided to try the complete Visual Studio 2008 C++ Express version and it worked!! :thumbsup: (After this i could also generate the handranks table so downloading this file was not needed.)

Link to comment
Share on other sites

@Geir1983

Thanks for that. You are correct. Installing the complete Visual Studio 2008 C++ Express version enabled XPokerEval.TwoPlusTwo.exe to create the HandRanks.dat data file.

However for my system, "Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64", I had to add and modify this:-

#AutoIt3Wrapper_UseX64=N
#AutoIt3Wrapper_Plugin_Funcs =LoadHRDat, AnalyzeHand

Note the space after "#AutoIt3Wrapper_Plugin_Funcs" and before the equal sign. The script does not work without that space.

Strange Behaviour

With this script working, the $handEval variable in $handEval = PluginOpen("handEval.dll") contains a zero. From the help file, this means the PluginOpen function failed: and,

The PluginClose function returns "True" and not "1" as per the help file.

Link to comment
Share on other sites

Glad I could help :) I run a virtual machine with 32 bit OS so i did not have any troubble with 64 bit OS.

Not sure if I am doing something wrong or just dont understand the return types from the analysis. When analyzing 5 and 6 card i get hand categories that are not within 1-9 range. Is it some other bitshift operation that is needed for the return of functions "AnalyzeHand5" and "AnalyzeHand6" perhaps?

Here is an example of my return:

12:31:13, Startup

12:31:14, Dealt Hand: Kc, Td

12:31:14, ChenStartHandFormula() rating: 6 of hand: Kc - Td

12:31:14, Dealt Flop: Th, 8s, 4d

12:31:14, AnalyzeHand5() My Hand Category: 2665, My Category Strength: 3061

12:31:14, Dealt Turn: 8d

12:31:14, AnalyzeHand6() My Hand Category: 6646, My Category Strength: 2865

12:31:14, Dealt River: Ad

12:31:14, AnalyzeHand() My Hand Category: 3, My Category Strength: 385

12:31:14, Complete Hand: Kc, Td - Th, 8s, 4d, 8d, Ad

Any suggestions?

Edit:

@Malkey: For the PluginOpen i used this:

$handEval = PluginOpen(@ScriptDir & "handEval.dll")

Edited by Geir1983
Link to comment
Share on other sites

Found out that the functions AnalyzeHand5 and AnalyzeHand6 returned wrong values, no bitshift or bitmasks would correct it. When compiling the source (http://www.codingthewheel.com/file.axd?file=XPokerEval.zip) I could get correct values for 5 and 6 hand evaluation. I have now compiled a new version compatible to the original evalHand.dll function, but I think it needs some memory cleanup routines before I will upload it (first ever au3 Plugin i created).

New function results:

12:47:50, Dealt Hand: 9c, Kd

12:47:50, ChenStartHandFormula rating: 4 of hand: 9c - Kd

12:47:50, Dealt Flop: 4c, Js, 9h

12:47:50, AnalyzeHand5() My Hand Category: 2, My Category Strength: 1691

12:47:50, Dealt Turn: 9d

12:47:50, AnalyzeHand6() My Hand Category: 4, My Category Strength: 516

12:47:50, Dealt River: 4h

12:47:50, AnalyzeHan() My Hand Category: 7, My Category Strength: 87

12:47:50, Complete Hand: 9c, Kd - 4c, Js, 9h, 9d, 4h

Edit:

I uploaded the new dll file including the source for the dll if someone cares to clean up the dll.

Edited by Geir1983
Link to comment
Share on other sites

  • 3 weeks later...

So the only way to get this to work is with a new updated DLL - this does not compute (though it may fix the hand issues with 5 and 6 hands, it does not answer the DLL file issue. I have always had all the files and swear that it worked for a while - then maybe AutoIt changed (I updated to newer version?) but anyway that is when the error started.

Unknown function name.:

$dat = LoadHRDat()

$dat = ^ ERROR

I assumeed it was something to do with the calling of the DLL with CallDLL() - I think that was the function. But it still does not answer how it was able to work with just opening the file in Visual Studio 2008 C++ Express.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

It would!!! I have created my own code to do what this is doing, and it works - though I am sure that it is not as fast as this method. I will be posting my code soon, as soon as I finish the AI for the players.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • 2 weeks later...

I assumeed it was something to do with the calling of the DLL with CallDLL() - I think that was the function. But it still does not answer how it was able to work with just opening the file in Visual Studio 2008 C++ Express.

Sorry if I was not clear enough, but you need to install Visual Studio 2008 C++ Express on the same machine as you are executing your script.

By the way, regarding speed.. The original method is super fast, but the dll call etc from autoit is making it slow(er). For my purpose it is still fast enough, but i think it has lost alot of the speed. So the original test enumerating all 133 mil hands completed in 1200ms executed as C++ code, in my project where it is converted to autoit dll 130 k calls of the routine needs 3-4 seconds to complete (however my method is doing alot of other lines of code in the same loop so not directly comparable). For my needs its fast enough, but it is not the same as the original source.

Link to comment
Share on other sites

  • 2 years later...

Hello,

I am trying to make it work nowadays and stuck as it usually happens with newbie. I have created the 123 MB HandRanks.dat file :) (VS2008 c++ express edition needed). The PluginOpen/PluginClose functions is not supported anymore so I have replaced it with DLLOpen/DllClose in RandomHandGenerator.au3 from "Poker Hand evaluator plugin" Geir1983. Also I have replaced

;line 17
$dat = LoadHRDat()

;line38
$Analysis = AnalyzeHand($myHand[0], $myHand[1], $myHand[2], $myHand[3], $myHand[4], $myHand[5], $myHand[6])

with

$dat = DllCall($handEval, Int, 'LoadHRDat')

$Analysis = DllCall($handEval, int, 'AnalyzeHand', int, $myHand[0], int, $myHand[1], int, $myHand[2], int, $myHand[3], int, $myHand[4], int, $myHand[5], int, $myHand[6])

 

and after this script starts but after clicking "Deal new hand" stops with error 

Starting file RandomHandGenerator.au3...

"D:\Downloads\PokerEval\PokerEval\RandomHandGenerator.au3" (50) : ==> Variable subscript badly formatted.:
$k = $k + $Category[$j]
$k = $k + $Category[^ ERROR

Return type "int" in DllCall was choosed randomly as script starts with it and dont start with "string" type for example. Maybe I am wrong here.

After this I have tried to change

;line 42
For $j = 8 to $HandCategory-1 step -1
$k = $k + $Category[$j]
Next
            
;line 49
MsgBox(0,"1", $HandString & @CRLF &"Type of Hand:"&$HandRanksArray[$position][0] &@CRLF& "Best 5 Card Hand:"& $HandRanksArray[$position][2] &@CRLF& "Generated and evaluated Hand in :" & $dif & " milliseconds." & @CRLF & "Hand Strength:" & Round(100*($HandRankWithinCategory/($Category[$HandCategory-1]))) & "%")

to

For $j = 8 To $HandCategory Step -1
    $k = $k + $Category[$j]
Next


MsgBox(0, "1", $HandString & @CRLF & "Type of Hand:" & $HandRanksArray[$position-1][0] & @CRLF & "Best 5 Card Hand:" & $HandRanksArray[$position-1][2] & @CRLF & "Generated and evaluated Hand in :" & $dif & " milliseconds." & @CRLF & "Hand Strength:" & Round(100 * ($HandRankWithinCategory / ($Category[$HandCategory]))) & "%")

 

and script always show the same evaluation result but random 7 cards were generated.

It always show:

type of hand: High Card

best 5 card hand: 75432

Hand strength: 0%

 

Please help to make it work. :)

Capture.JPG

RandomHandGenerator.au3

Link to comment
Share on other sites

  • 2 weeks later...

Not to necro post but it looks like you have not gotten a response so I thought I would let you know your post/question inspired me to create a different poker script that I placed here: https://www.autoitscript.com/forum/topic/170414-pokerlogicau3/ in case you want to try it.  It is all native au3 with no dll.

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...