Giter Site home page Giter Site logo

treys's Issues

Winning cards from rank

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.

Request: Hash suit in accordance to poker rules

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).

CHAR_SUIT_TO_INT_SUIT = {

Comparisons between ranks work nicely, but comparison within ranks is not in accordance with the conventional suit hierarchy.

image

Would there be any side-effects with full-hand evaluation by reversing the current ordering of suits?

IndexError: pop from empty list

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

Empty board evaluation

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.

Possible incorrect hand evaluation

Could you have a look at my screenshot? I think the hand evaluation is wrong because that is not supposed to be straight.
2021-01-23_4-04-45

`
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 + ']')

`

Add treys to PyPI?

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.

There seems to be a mistake?

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!

how to remove a specific card from the deck

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

Evaluate only in turn

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 !!

Support for starting hand (2 cards)

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.