Seikez wrote:
I need a reliable, easy to use and fast (in that priority order) hand evaluator for my Holdem C# Bot. Preferably with documentation and usage examples.
So for this bot
It should handle preflop, flop, turn and river (2, 5, 6 and 7 cards). It should handle 1 - 9 opponents. I also need functions to calculate win probability, EV and other things my bot might need.
The alternatives I have found are all several years old, which makes me unsure which is the best choice today.
I therefore turn to you guys for some advice, it will be greatly appreciated!
Hi I was reading through this thread and can tell you from personally coding hand evaluators in both C# and then porting my code to c++ is that C++ is faster.
I have two apps that sell in the iTunes app store one is cloud based Windows Azure Single Core processor with C# api engine based a lot of the same approach that Keith Rule did.
The other was converted to c++ and Runs for five HORSE games and uses logic and approach from various libraries and own code, none of which are poker eval, although im sure all the ideas derived from that since its pretty much the grandfather of evaluators. I used similar logic and approach for holdem to Stud and Eight or better. I do not use pinvoke and I do not have lookup tables since I can't have an app in the store that is 150mb
Pointers make a huge difference and while you can use unsafe code in c# it still is not as fast as moving to raw c++.
If you use Keith Rules Code base you should get pretty fast times.
If you want to know how equity can be incorporated into it, Here is what I did and its how you could use Keith Rules Library since the if logic is nearly the same for all evaluators.
In Keith's the evaluator code where you see a line like
for(int i = 0; i < playerCount; i++)
{
if(pocketHands[i] == bestpocket)
{
if(bestCount > 1)
{
//Equity numerator is a "1" its always 1 divided by the number of people participating in the tie.
playerEquity[i] += equitynumerator / bestcount;
playerties[i] ++;
}
else
{
playerwins[i]++;
playerEquity[i]++;
}
}
}
I have separate arrays since I want wins, ties and equity. Look at Keith's code and you can add a float or double whichever to get the equity on top of wins or ties.
The key is knowing how many people tie on each iteration. Is there a faster way to do this ? I imagine sure probably many but that worked for me.
Also to make your c# code slightly faster go into the settings and check "allow unsafe code" Your c# will run faster and you will not be jeopardizing anything.
I had originally used some of the code logic from Keith Rules project when I had done the C# version but starting deviating and then by the time I had writing the c++ logic more of it was new new besides assigning values to cards.
I suspect most of the commercial poker software be it, HUDs, odds calculators are using some evolution of poker eval, Two Plus Two etc. The lookup tables are the fastest but you can still get terrific speeds without.
Now do a search for PokerStove evaluator.
The guy recently put all of his source code available for download and most people consider that the best Equity Calculator.
https://github.com/andrewprock/pokerstoveI haven't looked at this yet but bet a lot of his logic is similar to the older libraries.
Feel free to email me
[email protected] if you have any other questions I like helping out others when I can since if it wasn't for these open source libraries most
of the software would never exist at least not as widely as it does today