ihendley / treys Goto Github PK
View Code? Open in Web Editor NEWThis project forked from msaindon/deuces
A pure Python poker hand evaluation library
License: MIT License
This project forked from msaindon/deuces
A pure Python poker hand evaluation library
License: MIT License
When comparing single cards, it can be helpful to compare the hashed values of two cards to each other.
For instance, if I want to compare the A♠ to the A♣, the A♠ should hash to the greater value.
This follows the usual poker suit hierarchy:
Spades
Hearts
Diamonds
Clubs
Currently, the code in cards.py
makes clubs hash to a higher value than spades (ranks being equal).
Line 35 in 70b481c
Comparisons between ranks work nicely, but comparison within ranks is not in accordance with the conventional suit hierarchy.
Would there be any side-effects with full-hand evaluation by reversing the current ordering of suits?
I am trying to repeatedely evaluate random hands with the deck.draw() method, however after a few times of running it sequentially, it returns an error:
File "c:\Users\XXXXX\main.py", line 57, in <module>
evalHand()
File "c:\Users\XXXXX\main.py", line 14, in evalHand
board = deck.draw(5)
File "C:\Python39\lib\site-packages\treys\deck.py", line 27, in draw
cards.append(self.draw())
File "C:\Python39\lib\site-packages\treys\deck.py", line 23, in draw
return self.cards.pop(0)
IndexError: pop from empty list
Sorry to ask this here, it's less of an issue than a request for explanation.
The "Evaluator.evaluate" method contains a docstring stating that empty boards can be used, but I can't figure it out.
My use case is that I'd like to evaluate hands before the flop (basically playing the entire game open-faced).
Hope you can shed some light on this, and thanks again for maintaining this fork.
Is there any repo that supports 2 card (starting hand) evaluation? If not I would hard code it anyway and add to this repo if it is ok.
Thanks!
Is there a method to get the list of the individual cards that make-up the best 5-card hand out of the 7 cards that are submitted to the evaluator? This would be useful for graphically highlighting the cards that comprise the best 5-card hand or to pretty_print them.
https://i.gyazo.com/40ddf48b9a565d53d3afcc5eb639ed41.png
Any idea why?
Could you have a look at my screenshot? I think the hand evaluation is wrong because that is not supposed to be straight.
`
from card import *
from evaluator import *
from deck import *
deck = Deck()
board = deck.draw(5)
print(Card.print_pretty_cards(board))
evaluator = Evaluator()
players = [deck.draw(2) for i in range(10)]
for i in range(len(players)):
handstr = Card.print_pretty_cards(players[i])
evalint = evaluator.evaluate(board, players[i])
ranknum = evaluator.get_rank_class(evalint)
rankname = evaluator.class_to_string(ranknum)
print('Hand: ' + handstr + 'Eval :' + str(evalint) +
', Rank No. ' + str(ranknum) + ' [' + rankname + ']')
`
hello, I want to know if it is possible to remove specific card from the deck.
because I want to choose 2 card a the beginning of the code and after create random card for a second player and for the board but how to remove the 2 card I first choose.
tanks for your help
When i run card.py it happens a TypeError. Why is this?
line 33, in Card
PRIMES: list[int] = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41]
TypeError: 'type' object is not subscriptable
Thanks!
Hey, I'd love to use this lib! Would rather not copy/paste code directly into my repo, and git submodules aren't a good solution for me (my repo will be used by non-coders so don't want to field git submodule
questions :)
Any chance you'd be open to adding treys
to PyPI? I've never done this but I'd be happy to take a stab and make a PR.
Hi there,
your codes are great working, how can I Evaluate only in turn ?
I want to get the win possibility percentage of hands with only 3 cards on board !!
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.