julianandrews / pyeval7 Goto Github PK
View Code? Open in Web Editor NEWPython Texas Hold'em hand evaluation and equity calculation library
License: MIT License
Python Texas Hold'em hand evaluation and equity calculation library
License: MIT License
Keep getting error for py3.12 when trying to pip install eval7
Hi mate,
I am always me.
I will try to explain my issue and why I edited a piece of your code, and how and why so if you need it for your AI you can reuse it.
First of all, I edited equity.pyx (I added the bold to the changes):
cdef tuple hand_vs_range_monte_carlo(unsigned long long hand, ...):
cdef unsigned int wins = 0
cdef unsigned int tie = 0
if hero > villain:
**wins += 1**
elif hero == villain:
**tie += 1**
**return <double>wins / <double>iterations, <double>tie / <double>iterations**
Let me explain, I encountered a lot of problems trying to clustering rivers combinations (hand + 5 cards) and I have tried many different solutions (your equity, machine learning tequines like k-mean, manually and a combination of all these mentioned above).
The first solution was simply creating 1002 clusters (from equity 0, ..., 0.342, 0.343, ..., 0.5, ..., 0.789, ... to 1.0) but the problem was a missing of board informations. For him a board like "sssss" (a flush on the board) with no flushes in the cards of the hand was good as a middle pair. And of course that's not good. You can't cluster these two type of hands because are too different (AI was really weak with that type of clustering), but if you offer him the percentage of tie he can detect better a lot of board patterns.
My post isn't a issue, it was only a discussion to have a comparison and get more ideas.
And thank you for all
My code is 50% C++ and 50% Python and I connect the first with the second troguht different hacks (es. I generate dinamically C++ code with Python and then I include it with #include, or I open the shell, call the python script and it reads the pipeline and so on).
One problem I had is to generate a great number of hands trought your library in a "acceptable" time and I want to share with you my three different solutions with relative benchmarks.
import time
import random
import numpy as np
import eval7 as e7
######################
bench = time.time()
for i in range(1000000):
deck = e7.Deck()
deck.shuffle()
hands = deck.deal(4)
board = deck.deal(5)
print("bench1:", time.time() - bench)
######################
bench = time.time()
deck = e7.Deck()
deck.shuffle()
cards = deck.deal(52)
for i in range(1000000):
random.shuffle(cards)
hands = cards[:4]
board = cards[4:9]
print("bench2:", time.time() - bench)
######################
bench = time.time()
num_iters = 1000000
combos = np.random.randint(52, size=(num_iters, 9))
deck = e7.Deck()
cards = np.array(deck.deal(52))
for i in range(1000000):
hands = cards[combos[i][:4]]
board = cards[combos[i][4:]]
print("bench3:", time.time() - bench)
bench1: 177.55185198783875
bench2: 77.64555835723877
bench3: 18.77227473258972
Vanilla eval7 is the worst, the most "compatible" with simple edit of library code is the second one, and the last one is the most difficult to integrate and reuse it but the difference of performances has no rivals.
When I run something like
d = Deck()
I get the error:
E TypeError: 'cython_function_or_method' object does not support vectorcall
It works fine on Python 3.7 however.
This would be useful if I ever want a new windows distribution of FlopFerret
Hi, it looks great.
I want make easy software to train Range vs Range equity on various flops. I am not good programmer, but if I understand it, pyeval7 dont have this function.
I tried pokereval, but results are differents from results in poker softwares, is it difficult to implement? Or dont you have some advice about it?
Thanks,
Martin Psik
Right now I've only built wheels for python 3.7 on Linux
Right now I've just uploaded the python3.7 wheel, but with docker I should be able to build manylinux wheels for all python versions.
Hi mate,
I'm using your montecarlo to feeds my NN, but I noticed strange results. For example on
54sh KJT88shhhc
with a calculator for heads-up like a pokerstove I obtain 0% win an ~25% of tie.
With your code I obtain "only 12%". So, 2 questions:
Btw, I like very much your code, helped me a lot for different tasks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.