- Created Sunday, June 8th 2014 @ 12:19:53
Monte Carlo sampling is probably the best way to determine our odds of winning, even the engine is using it. Unfortunately, it's useless without randomness, and currently it's not possible to import the random module in Python. Should we expect a fix or is this intended?
- Created Sunday, June 8th 2014 @ 15:05:13
Thanks, I'll try to use that until there is a fix. I'm not sure if it's random enough though.
- Updated Sunday, June 8th 2014 @ 16:47:59
The one implemented in the python starter-bot certainly is not random. It is completely time bound, so you could basically only use it to produce one number each turn. They have been trying to fix the random/numpy issue, but so far unsuccessful. I used someone's Mersenne Twister implementation which is rather slow, but is the best solution I've found at this point.
I posted the code online here http://pastebin.com/KNwd0VWJ, but would again ask the developers to try fixing these libraries again as the time gain is about 2x the random.random() implementation.
- Created Sunday, June 8th 2014 @ 22:28:26
Thanks for sharing that RNG. You saved me a lot of headaches.
- Created Thursday, April 23rd 2015 @ 00:35:40
If you're willing to set up Cython feel free to use the random replacement I just finished up. It uses C's native rand() function so it should work just as well as Python's builtin random module. In profiling it looks like they perform about the same in Python modules, and it's faster during cython-to-cython method invocations.
I only implemented the functions I needed, pull requests (with tests!) welcome if there's something you'd like to add: https://github.com/gnmerritt/poker/blob/master/pokeher/cython_random.pyx