better printing, new release candidate, linting
This commit is contained in:
parent
fb66902f59
commit
5bdc1c8192
9
Makefile
9
Makefile
@ -1,4 +1,4 @@
|
|||||||
build: clean
|
build: clean lint
|
||||||
python -m build --sdist --wheel -n
|
python -m build --sdist --wheel -n
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@ -8,8 +8,11 @@ publish: build
|
|||||||
twine upload dist/*
|
twine upload dist/*
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
|
isort --profile black .
|
||||||
black .
|
black .
|
||||||
isort .
|
|
||||||
flake8 --max-line-length=88 --extend-ignore=E203,W503 pyroulette/
|
flake8 --max-line-length=88 --extend-ignore=E203,W503 pyroulette/
|
||||||
|
|
||||||
.PHONY: build publish clean lint
|
test: # TODO: replace with real tests
|
||||||
|
python app.py && python strategy.py
|
||||||
|
|
||||||
|
.PHONY: build publish clean lint test
|
90
app.py
90
app.py
@ -1,8 +1,19 @@
|
|||||||
from random import choice, randint, seed
|
from random import choice, randint, seed
|
||||||
|
|
||||||
from pyroulette import (FEASIBLE_MOVES, Bet, Placement, Player, Strategy,
|
from pyroulette import (
|
||||||
expected, generate_players, init_spread, interpret_bet,
|
FEASIBLE_MOVES,
|
||||||
place_bet, play_roulette)
|
Bet,
|
||||||
|
Placement,
|
||||||
|
Player,
|
||||||
|
Strategy,
|
||||||
|
expected,
|
||||||
|
generate_players,
|
||||||
|
init_spread,
|
||||||
|
interpret_bet,
|
||||||
|
place_bet,
|
||||||
|
play_roulette,
|
||||||
|
simulate_random_strategy,
|
||||||
|
)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
@ -27,51 +38,56 @@ if __name__ == "__main__":
|
|||||||
print(bet)
|
print(bet)
|
||||||
print(expected(bet))
|
print(expected(bet))
|
||||||
print()
|
print()
|
||||||
# print("unknown")
|
print("unknown")
|
||||||
# bet = init_bet()
|
bet = Bet()
|
||||||
# bet = interpret_bet("1-12", 15, bet)
|
bet = interpret_bet("1-12", 15, bet)
|
||||||
# bet = interpret_bet("13-24", 15, bet)
|
bet = interpret_bet("13-24", 15, bet)
|
||||||
# bet = interpret_bet("corner-26-27-29-30", 5, bet)
|
bet = interpret_bet("corner-26-27-29-30", 5, bet)
|
||||||
# bet = interpret_bet("corner-32-33-35-36", 5, bet)
|
bet = interpret_bet("corner-32-33-35-36", 5, bet)
|
||||||
# print(bet)
|
print(bet)
|
||||||
# print(expected(bet))
|
print(expected(bet))
|
||||||
# print()
|
print()
|
||||||
# print("singles")
|
print("singles")
|
||||||
# bet = init_bet()
|
bet = Bet()
|
||||||
# bet = place_bet(bet, 21, 40)
|
bet = place_bet(bet, 21, 40)
|
||||||
# # bet = place_bet(bet, 1, 1)
|
# bet = place_bet(bet, 1, 1)
|
||||||
# print(expected(bet))
|
print(expected(bet))
|
||||||
# print()
|
print()
|
||||||
# print("stupid")
|
print("stupid")
|
||||||
# bet = init_bet()
|
bet = Bet()
|
||||||
# bet = interpret_bet("odd", 18, bet)
|
bet = interpret_bet("odd", 18, bet)
|
||||||
# bet = interpret_bet("even", 18, bet)
|
bet = interpret_bet("even", 18, bet)
|
||||||
# # bet = place_bet(bet, -1, 1)
|
# bet = place_bet(bet, -1, 1)
|
||||||
# # bet = place_bet(bet, 0, 1)
|
# bet = place_bet(bet, 0, 1)
|
||||||
# print(expected(bet))
|
print(expected(bet))
|
||||||
|
|
||||||
# min_games = randint(1, 10)
|
min_games = randint(1, 10)
|
||||||
# print(min_games, Player(200, simulate_random_strategy(min_num_games=min_games, total_budget=200)))
|
print(
|
||||||
|
min_games,
|
||||||
|
Player(
|
||||||
|
200, simulate_random_strategy(min_num_games=min_games, total_budget=200)
|
||||||
|
),
|
||||||
|
)
|
||||||
# create a list of random Placements
|
# create a list of random Placements
|
||||||
|
|
||||||
# placements = [
|
placements = [
|
||||||
# Placement(randint(1, 10), 1, choice(list(FEASIBLE_MOVES))) for _ in range(10)
|
Placement(randint(1, 10), 1, choice(list(FEASIBLE_MOVES))) for _ in range(10)
|
||||||
# ]
|
]
|
||||||
|
|
||||||
# strategy = Strategy.generate_random(50)
|
strategy = Strategy.generate_random(50)
|
||||||
|
|
||||||
# strategy.print_all()
|
strategy.print_all()
|
||||||
|
|
||||||
# define the minimum number of games that you want players to play
|
# define the minimum number of games that you want players to play
|
||||||
|
|
||||||
# print the total sum of all the placements
|
# print the total sum of all the placements
|
||||||
# print("SUM")
|
print("SUM")
|
||||||
# print(sum([p.value for p in placements]))
|
print(sum([p.value for p in placements]))
|
||||||
|
|
||||||
# # place the bets
|
# place the bets
|
||||||
# bet = Strategy.place_bets(placements)
|
bet = Strategy.place_bets(placements)
|
||||||
|
|
||||||
# print(bet)
|
print(bet)
|
||||||
|
|
||||||
# set a random seed
|
# set a random seed
|
||||||
seed(42)
|
seed(42)
|
||||||
|
@ -440,12 +440,14 @@ class Player:
|
|||||||
self.wallet: float = self.budget
|
self.wallet: float = self.budget
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
|
_nl = "\n\t" # custom newline character
|
||||||
return (
|
return (
|
||||||
f"Player(id={self.id}, budget={self.budget}, wallet={self.wallet},"
|
f"Player(id={self.id}, budget={self.budget}, wallet={self.wallet},"
|
||||||
+ f"strategy={sorted(self.strategy.placements)},"
|
+ f"num_placements={len(self.strategy.placements)}, "
|
||||||
+ f"strategy_cost={self.strategy.value},"
|
+ f"strategy_budget={self.strategy.budget}, "
|
||||||
+ f"strategy_budget={self.strategy.budget},"
|
+ f"strategy_cost={self.strategy.value}"
|
||||||
+ f"num_placements={len(self.strategy.placements)}"
|
+ f"\nstrategy:{_nl}{_nl.join(map(str, sorted(self.strategy.placements)))}"
|
||||||
|
+ "\n)"
|
||||||
)
|
)
|
||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
|
2
setup.py
2
setup.py
@ -10,7 +10,7 @@ with open(BASEDIR.joinpath("README.md"), "r") as fp:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="pyroulette",
|
name="pyroulette",
|
||||||
version="0.0.1rc2",
|
version="0.0.1rc3",
|
||||||
description="A package for exploring roulette strategies.",
|
description="A package for exploring roulette strategies.",
|
||||||
long_description=LONG_DESCRIPTION,
|
long_description=LONG_DESCRIPTION,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
|
Loading…
Reference in New Issue
Block a user