linting
This commit is contained in:
parent
91ba00e6ea
commit
2d1cd57ef9
@ -1 +1 @@
|
||||
from .roulette import * # noqa: F401, F403
|
||||
from .roulette import * # noqa: F401, F403
|
||||
|
@ -24,7 +24,6 @@ def init_spread() -> Dict[int, float]:
|
||||
return D
|
||||
|
||||
|
||||
|
||||
# for two bets of structure Dict[int, float], iterate through all the keys and add up the values, returning a new dict.
|
||||
def combine_bets(bet_1: Bet, bet_2: Bet) -> Bet:
|
||||
"""
|
||||
@ -46,10 +45,10 @@ def combine_bets(bet_1: Bet, bet_2: Bet) -> Bet:
|
||||
return Bet({k: bet_1[k] + bet_2[k] for k in set(bet_1) | set(bet_2)})
|
||||
|
||||
|
||||
|
||||
@dataclass
|
||||
class Bet:
|
||||
"""A class for representing a bet."""
|
||||
"""A class for representing a bet."""
|
||||
|
||||
spread: Dict[int, float] = field(default_factory=init_spread)
|
||||
|
||||
@property
|
||||
@ -90,7 +89,7 @@ class Bet:
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self.spread.keys())
|
||||
|
||||
|
||||
def get(self, __name: int) -> float:
|
||||
return self.spread.get(__name, 0)
|
||||
|
||||
@ -316,6 +315,7 @@ class Placement:
|
||||
"""
|
||||
return interpret_bet(self.on, self.num * self.amt, bet)
|
||||
|
||||
|
||||
# for a list of Placements, call the place_bet method on each one and combine the results using reduce and combine_bets, starting with an empty dictionary as the initial argument
|
||||
|
||||
|
||||
|
10
strategy.py
10
strategy.py
@ -2,11 +2,15 @@ from pyroulette.roulette import Placement, Strategy, Bet
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(Bet({-1: 1}).__repr__()) # this should print with 00
|
||||
print('get test')
|
||||
print("get test")
|
||||
print(Bet({0: 1})[21])
|
||||
print(Bet({21: 1})[21])
|
||||
print('sum test')
|
||||
print("sum test")
|
||||
print(Bet({0: 1}) + Bet({0: 1}))
|
||||
print(Bet({0: 1}) + Bet())
|
||||
# this should return 1's in everything but 0 and -1.
|
||||
print(Strategy(placements=[Placement(18, 1, "red"), Placement(18, 1, "black")]).get_bet())
|
||||
print(
|
||||
Strategy(
|
||||
placements=[Placement(18, 1, "red"), Placement(18, 1, "black")]
|
||||
).get_bet()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user