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

Roadmap

Features

  • Hand evaluation
  • Hand comparison
  • Deck support
  • Board & dealing (Flop, Turn, River)
  • Full board & hole card evaluation
  • Expand beyond Texas Hold 'Em (Pot Limit Omaha)

Deployment

  • CI

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.2.tar.gz (10.1 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.2-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tilted-0.1.2.tar.gz
  • Upload date:
  • Size: 10.1 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.2.tar.gz
Algorithm Hash digest
SHA256 8c8a369578e58cd30573410a9e222026373673ffbd20f3d06af47d946761027f
MD5 0b31e2575538796f6fb01ca14a93108c
BLAKE2b-256 d05e4fabf1c352478400db16c355445e1f684c8dda8693ecc7735c3ea3ae3c53

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tilted-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fabd35d9237134c1196838fbb1c4901e87b912aa81d5f30736b3eda9333e1b61
MD5 d254c46eca585e2dd88588a866474c07
BLAKE2b-256 dcbaa8c24c596a71357c15f8b0300b9c1eb5739b54187a5c503cf5dc3af25189

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