Description
Xtreys(eXtended treys) is a lightweight add-on to the library Treys. Xtreys uses integers created from Treys to rank hole cards, calculate equity, etc.
Installation
First, open your terminal and run:
pip install git+https://github.com/bingchiliingsacker-dot/Xtreys.git
or:
pip install xtreys
Note: If you run into any issues installing or using Xtreys, feel free to open a ticket on the Issues tab!
Usages
One of Xtreys' goals is to evaluate hole cards only. Cards are ranked from 1 to 91 with 'A-A' or pocket Ace's being the strongest and a '2-7' being the weakest hand
The function for this is preflop_eval.
Here is a quick test to see if Xtreys is working:
from treys import Deck
from xtreys import preflop_eval
d = Deck()
cards = d.draw(2)
rank = preflop_eval(cards)
print(f"Pre-flop hand rank:\t{rank}") #Output: Pre-flop hand rank: 1-91
Another usage of Xtreys is calculating the approximate and accurate equity of cards.
approximate_equity gives an approximate equity from 0.1(lowest) to 0.9(highest).
Heres a quick test:
from xtreys import approximate_equity
d = Deck()
cards = d.draw(2)
flop_board = d.draw(3)
turn_card = d.draw(1)
river_card = d.draw(1)
turn_board = flop_board + turn_card
river_board = flop_board + river_card
flop_equity = approximate_equity(cards, flop_board)
print('---Flop---')
print(f'Approximate equity:\t{flop_equity}')
print('')
turn_equity = approximate_equity(cards, turn_board)
print('---Turn---')
print(f'Approximate equity:\t{turn_equity}')
print('')
river_equity = approximate_equity(cards, river_board)
print('---River---')
print(f'Approximate equity:\t{river_equity}')
'''
Output:
---Flop---
Approximate equity: 0.2
---Turn---
Approximate equity: 0.3
---River---
Approximate equity: 0.2
'''
Accurate equity outputs a much more pinpoint equity than approximate equity, it needs a cards variable of type list[int], a board variable of type list[int], and how many Monte-Carlo simulations you want to make(default=50).
Heres a quick test for accurate_equity:
from xtreys import accurate_equity
d = Deck()
cards = d.draw(2)
flop_board = d.draw(3)
turn_card = d.draw(1)
river_card = d.draw(1)
turn_board = flop_board + turn_card
river_board = flop_board + river_card
flop_equity = accurate_equity(cards, flop_board, 100)
print('---Flop---')
print(f'Accurate equity:\t{flop_equity:.2f}')
print('')
turn_equity = accurate_equity(cards, turn_board, 150)
print('---Turn---')
print(f'Accurate equity:\t{turn_equity:.2f}')
print('')
river_equity = accurate_equity(cards, river_board)
print('---River---')
print(f'Accurate equity:\t{river_equity:.2f}')
'''
Output:
---Flop---
Accurate equity: 0.54
---Turn---
Accurate equity: 0.39
---River---
Accurate equity: 0.30
'''
relative_equity outputs almost the same equity as accurate_equity, the only difference between the two is that relative_equity calculates the equity of the players hand based on behavior unlike accurate_equity which is accurate mathematically.
Here is a quick test for relative_equity:
from treys import Deck
for _ in range(5):
deck = Deck()
cards = deck.draw(2)
board = deck.draw(3)
opp_cards = [
deck.draw(2),
deck.draw(2),
deck.draw(2)
]
choice = ['bet', 'fold', 'check', 'call', 'raise', 'all_in']
decision = choices(choice, k=3)
equity = relative_equity(
cards=cards,
board=board,
opp_cards=opp_cards,
decision=decision,
average_aggression=uniform(0.0, 10.0)
)
print('---Relative Equity Test---')
print(f'cards:\t{cards}')
print(f'Opponent cards:\t{opp_cards}')
print(f'Board:\t{board}')
print(f'Equity:\t{equity}')
print('')
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xtreys-0.2.41.tar.gz.
File metadata
- Download URL: xtreys-0.2.41.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26be8bf4ebb56b2fc7da6acf9afeb0d7f932057b1d76dd7ae61a6531d6fefc4a
|
|
| MD5 |
97971dff1d658c4b52a0304bc4e94178
|
|
| BLAKE2b-256 |
519fa026088fd2e0584d60d09fb73895781a194a9e8dd6f71d7daa72b7d6fd02
|
Provenance
The following attestation bundles were made for xtreys-0.2.41.tar.gz:
Publisher:
python-publish.yml on bingchiliingsacker-dot/Xtreys
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xtreys-0.2.41.tar.gz -
Subject digest:
26be8bf4ebb56b2fc7da6acf9afeb0d7f932057b1d76dd7ae61a6531d6fefc4a - Sigstore transparency entry: 2569863957
- Sigstore integration time:
-
Permalink:
bingchiliingsacker-dot/Xtreys@5690a17492b296effdd01bda2bbce05728bed84d -
Branch / Tag:
refs/tags/v0.2.41 - Owner: https://github.com/bingchiliingsacker-dot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@5690a17492b296effdd01bda2bbce05728bed84d -
Trigger Event:
release
-
Statement type:
File details
Details for the file xtreys-0.2.41-py3-none-any.whl.
File metadata
- Download URL: xtreys-0.2.41-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b03610bcc7e06eddd20f885c7f422065821a9692639a88a5c3f7b9476710eea
|
|
| MD5 |
d58ed1edc682ca02f6297e4abbd4281a
|
|
| BLAKE2b-256 |
83cc36c92fbd96558209afad537a6c986833563773a11d727cdfd0d94729341b
|
Provenance
The following attestation bundles were made for xtreys-0.2.41-py3-none-any.whl:
Publisher:
python-publish.yml on bingchiliingsacker-dot/Xtreys
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xtreys-0.2.41-py3-none-any.whl -
Subject digest:
0b03610bcc7e06eddd20f885c7f422065821a9692639a88a5c3f7b9476710eea - Sigstore transparency entry: 2569864034
- Sigstore integration time:
-
Permalink:
bingchiliingsacker-dot/Xtreys@5690a17492b296effdd01bda2bbce05728bed84d -
Branch / Tag:
refs/tags/v0.2.41 - Owner: https://github.com/bingchiliingsacker-dot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@5690a17492b296effdd01bda2bbce05728bed84d -
Trigger Event:
release
-
Statement type: