Skip to main content

Tilted is a lightweight, open-source Python package with a simple interface for poker hand evaluation & comparison.

Project description

Tilted

Tilted is a lightweight, open-source Python package with a simple interface for poker hand evaluation & comparison.



Installation

With Poetry:

poetry add tilted

With Pip:

pip install tilted

Basic Usage

Tilted can be used to generate, evaluate and compare 5-card poker hands.

Hand Generation

To generate a random hand:

from tilted import Deck, Hand


deck = Deck()
unknown_hand = Hand(deck.draw_many(5))

unknown_hand  # <Hand: 8♦ T♠ T♣ Q♣ K♥>
unknown_hand.hand_rank  # <HandRank.PAIR: 2>

Hand Evaluation

To evaluate an unknown hand:

from tilted import Card, CardRank, CardSuit, Hand


unknown_hand = Hand([
  Card(CardRank.TEN, CardSuit.SPADES),
  Card(CardRank.JACK, CardSuit.SPADES),
  Card(CardRank.QUEEN, CardSuit.SPADES),
  Card(CardRank.KING, CardSuit.SPADES),
  Card(CardRank.ACE, CardSuit.SPADES),
])

unknown_hand.hand_rank  # <HandRank.ROYAL_FLUSH: 10>

Hand Comparison

To compare two hands:

from tilted import Card, CardRank, CardSuit, Hand


royal_flush = Hand([
  Card(CardRank.TEN, CardSuit.SPADES),
  Card(CardRank.JACK, CardSuit.SPADES),
  Card(CardRank.QUEEN, CardSuit.SPADES),
  Card(CardRank.KING, CardSuit.SPADES),
  Card(CardRank.ACE, CardSuit.SPADES),
])

straight_flush = Hand([
  Card(CardRank.NINE, CardSuit.HEARTS),
  Card(CardRank.TEN, CardSuit.HEARTS),
  Card(CardRank.JACK, CardSuit.HEARTS),
  Card(CardRank.QUEEN, CardSuit.HEARTS),
  Card(CardRank.KING, CardSuit.HEARTS),
])

royal_flush > straight_flush  # True

Game & Dealing

To create a game and deal cards to the board:

from tilted import Game


game = Game()

game.deal_next_street()
game.board.flop  # [A♦, A♠, A♣]

game.deal_next_street()
game.board.turn  # K♣

game.deal_next_street()
game.board.river  # Q♣

game.board.cards  # [A♦, A♠, A♣, K♣, Q♣]

Roadmap

Features

  • Hand evaluation
  • Hand comparison
  • Deck support
  • Board & dealing (Flop, Turn, River)
  • Player support
  • Full board & hole card evaluation
  • Simulations API and/or simulation examples

Deployment

  • CI
  • Badges

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tilted-0.1.3.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tilted-0.1.3-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file tilted-0.1.3.tar.gz.

File metadata

  • Download URL: tilted-0.1.3.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/19.6.0

File hashes

Hashes for tilted-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8dbaa926a511aae1815c22180725b6e9a65cac0fde483cf517df95be27547fdf
MD5 90d8d15b1d102f45bceadbbc3165fd3a
BLAKE2b-256 84f68e2e562bf713d07bc8fdad9473515047a1fde10fd06706bfd10da39edf3d

See more details on using hashes here.

File details

Details for the file tilted-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: tilted-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/19.6.0

File hashes

Hashes for tilted-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2a122daf8010071386ae085a523ec1ad10d94d8e319ff19e97f4e998de2de6ae
MD5 ce578a7b5032b75c3b2df894eea7d704
BLAKE2b-256 b7bee05f40c1a2e1080aac933603cbe04e4cd7eb7ef77d0b8d392d098967bca9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page