pyroulette
Explanation
-
A
Playerhas aStrategywhich is comprised of a list ofPlacements, which represent a collectiveBet. -
The player will stick to their strategy.
-
Winnings are re-invested (todo: allow specifying player's pyschology, e.g. pocket winnings of certain proportion)
-
A player's placement cannot be too complicated (max is 10)
-
A
Strategyis formed at random based on exhausting the strategy budget, which is determined by considering the player's total budget and the minimum number of games they desire to play.- It is possible to have some money left over (either due to reaching the maximum number of placements or not having enough money to place a bet with the remaining available chips), meaning the strategy budget is less than the cost to play the strategy.
- When players cannot play their strategy anymore, they leave the game, meaning they can end the simulation with some remaining money (e.g.
$100to play a$40strategy that you lose twice in a row will leave you with$20remaining).
-
When using
generate_players, all players will have the same number of minimum games and budget.
how to use
pip install pyroulette
from pyroulette import generate_players, play_roulette
players = generate_players(
num_players=50,
min_num_games=min_games,
total_budget=100
)
players = play_roulette(
players=players,
games=1000,
)
print("Results:")
for p in sorted(players, reverse=True):
print("\n", p)
print("Statistics")
# get the wallet values for all players as a list
wallets = [player.wallet for player in players]
# calculate some statistics
avg_wallet = sum(wallets) / len(wallets)
median_wallet = sorted(wallets)[len(wallets) // 2]
# calculate winnings
winnings = [p.wallet - p.budget for p in players]
num_losers = len([w for w in winnings if w <= 0])
num_winners = len([w for w in winnings if w > 0])
num_bankrupt = len([l for l in wallets if l == 0])
# print the results
print(f"Average wallet value: {avg_wallet}\n")
print(f"Median wallet value: {median_wallet}\n")
print(f"Number of players who lost money: {num_losers}, proportion: {num_losers / len(players):.2f}")
print(f"Number of players who went bankrupt: {num_bankrupt}, proportion: {num_bankrupt / len(players):.2f}")
print()
print(f"Number of players who won more than they started with: {num_winners}, proportion: {num_winners / len(players):.2f}")
Metadata
Release files for pyroulette 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyroulette-0.0.5.tar.gz | 11.1 kB | Without provenance | Details for pyroulette-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyroulette-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for pyroulette-0.0.5-py3-none-any.whl |
Total release size: 18.1 kB
Release files / pyroulette-0.0.5.tar.gz
| Download URL | pyroulette-0.0.5.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d296868b457bd343ae76db4efa8e2de8b8863249284f978b63a0a4220c9a2215
|
|
BLAKE2b-256 checksum How to use checksums |
52059eabb0ac6e826b44184f9869237b9868bd31c8ea6219d9b38f62c4ea37af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.7
|
Release files / pyroulette-0.0.5-py3-none-any.whl
| Download URL | pyroulette-0.0.5-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
343675dee42b0a81f0eedb85735dd18fb341aa4eca1bcdcf3234ed69198855f9
|
|
BLAKE2b-256 checksum How to use checksums |
847027c8eabeaf7c0679e0aebfd7952694bcc40f28776e133fedbb4232c5ac72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.7
|
Security for pyroulette 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.