Easily represent, progress, and visualize Bracket-style Tournaments
Project description
Tourneyket
Package to let you easily represent and progress Bracket-style single elimination Tournaments, allowing you to focus on matchup logic and analysis without worrying about the boilerplate. Supports 2, 4, 8, 16, 32, 64... 2^n starting teams.
The Bracket object accepts an initial bracket and a function to select matchup winner. Automatically fills out the rest of the bracket using whatever logic you provide, and implements a method to print out the final bracket to console in a nice, bracket shaped format.
Installation:
Install from pip:
pip install Tourneyket
Example:
from tourneyket import Bracket
# List of competitors. 1 plays 2, 3 plays 4... and so on. Likewise, winner of 1v2 plays winner of 3v4, etc.
my_tournament = [{"name": "Kitten State", "power_level": 9001},
{"name": "Bunnyville", "power_level": 6000},
{"name": "Muscle Hamsters", "power_level": 2},
{"name": "Doggy Dog World", "power_level": 8500},
{"name": "Horsies", "power_level": 8934},
{"name": "Lizard Wizards", "power_level": 7800},
{"name": "Ole Penguin", "power_level": 8300},
{"name": "Pigchamps", "power_level": 7500}]
def pick_by_power_level(a, b):
if a["power_level"] > b["power_level"]:
return a
else:
return b
MyBracket = Bracket(my_tournament)
# play_out_bracket accepts an optional pick_winner parameter.
# Default just picks a random winner in each matchup.
MyBracket.play_out_bracket(pick_winner=pick_by_power_level)
# Optional formatting= parameter lets you specify what to print instead of just printing the whole dictionary
# Can also specify spacing for how it is printed. Default is 20.
MyBracket.print_bracket(formatting=lambda t: t["name"], spaces=20)
Which outputs:
Kitten State
|----------------- Kitten State
Bunnyville
|----------------- Kitten State
Muscle Hamsters
|----------------- Doggy Dog World
Doggy Dog World
|----------------- Kitten State
Horsies
|----------------- Horsies
Lizard Wizards
|----------------- Horsies
Ole Penguin
|----------------- Ole Penguin
Pigchamps
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
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 tourneyket-1.0.1.tar.gz.
File metadata
- Download URL: tourneyket-1.0.1.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5da2530d6b63fec7bbb49e88999fb34a8d308baf25bbb4cf41e26171f1422546
|
|
| MD5 |
b68416d75b0f2aa5845c07c27765c55f
|
|
| BLAKE2b-256 |
15e404956b85de99c2292ef20c90482a9c532a772f647e269db6c9f884ad50ac
|
Provenance
The following attestation bundles were made for tourneyket-1.0.1.tar.gz:
Publisher:
python-publish.yml on shoenot/tourneyket
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tourneyket-1.0.1.tar.gz -
Subject digest:
5da2530d6b63fec7bbb49e88999fb34a8d308baf25bbb4cf41e26171f1422546 - Sigstore transparency entry: 186338777
- Sigstore integration time:
-
Permalink:
shoenot/tourneyket@3e55c6c3726efd41ec17d59878ab3e5e5925dd92 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/shoenot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3e55c6c3726efd41ec17d59878ab3e5e5925dd92 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tourneyket-1.0.1-py3-none-any.whl.
File metadata
- Download URL: tourneyket-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b19295815f0162109b9497e01c36151c8095987900537cb3d16c2b35e3ee275
|
|
| MD5 |
bc68c53b3c076d7995db25484a8ca5e7
|
|
| BLAKE2b-256 |
fe4b9d20574a10d920768548fcc8caa276faa9671f55fdef4ab0abeef12bf58f
|
Provenance
The following attestation bundles were made for tourneyket-1.0.1-py3-none-any.whl:
Publisher:
python-publish.yml on shoenot/tourneyket
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tourneyket-1.0.1-py3-none-any.whl -
Subject digest:
6b19295815f0162109b9497e01c36151c8095987900537cb3d16c2b35e3ee275 - Sigstore transparency entry: 186338778
- Sigstore integration time:
-
Permalink:
shoenot/tourneyket@3e55c6c3726efd41ec17d59878ab3e5e5925dd92 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/shoenot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3e55c6c3726efd41ec17d59878ab3e5e5925dd92 -
Trigger Event:
release
-
Statement type: