Poker-AI.org
http://poker-ai.org/phpbb/

Best way to calculate the handstrength
http://poker-ai.org/phpbb/viewtopic.php?f=24&t=3071
Page 1 of 1

Author:  AlephZero [ Sun Aug 20, 2017 10:53 am ]
Post subject:  Best way to calculate the handstrength

Hi guys. Part of the algorithm I'm developing requires to calculate various measures associated with the handstrenght for each single hand possible given the board. Ideally, I would like to tackle the problem with a monte-carlo simulation. I'm planning to code a wrapper in cython for poker-eval, becouse i'm less familiar in C++ than Python and i need to interface it to the rest of my app in Tensorflow python.
Any advice? This should be a good starting point https://pypi.python.org/pypi/eval7/0.1.2 .

Author:  spears [ Wed Aug 23, 2017 10:04 am ]
Post subject:  Re: Best way to calculate the handstrength

I'm an amateur at C++ and poker-source really made my head hurt when I looked at it. I reckon the twoplustwo evaluator is faster and using it is dead simple. (assuming you don't have memory limitations and you are looking for 7 card holdem evaluator)

Author:  ProfundMadman [ Tue Aug 29, 2017 9:06 pm ]
Post subject:  Re: Best way to calculate the handstrength

I use this calculator: https://github.com/ktseng/holdem_calc/b ... /README.md
Its a Monte Carlo simulation for python, with some minor adjustments you can make work in python 3+. Take in consideration that on if you give a board, it calculate the exact probability even if you specify you don't want the exact calculation. If you want to run a simulation you have to delete "if given_board is not None" from run_simulation() in holdem_calc.py

Author:  AlephZero [ Wed Aug 30, 2017 10:04 pm ]
Post subject:  Re: Best way to calculate the handstrength

Thanks spears and ProfundMadman for your suggestions. The handstrength simulator is the last part that I do not understand well how to do it of my project, for this I would like to solve it fairly quickly though not in the best way. I have difficulty working with a c ++ project, while one in pure python is too slow.


In conclusion, I think I have to rewrite my poker hand evaluator directly in tensorflow. I'm working on google cloud, so the ram and cpu limits are given by those that I can reasonably afford. What do you think is the most appropriate algorithm?
I'm thinking this:

- Batch, build the kevin's rule rank hash table for all 7 cards hands ( 133784560 hand ranks, every saved as a 4 byte integer so only 0,5 GB, maybe i've made a mistake seems too small). 64 cpu may cost 0.10-0.20$/hour, tips for parallelize this process?

- Online, for every hand simulate for N times a random opponent hand and a random board and update the win total of the hand through a table lookup. Here I can parallelize over the simulation (or over the hands).

-Return the win totals array / N.

I plan to make the batch script building the hash table in cython (reusing the code of the project in my first post) and then to use it in a pure tensorflow python API app.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/