def test_player_states(self): bet_amount = 10 self.player.win(Bet(self.outcomes[0], bet_amount)) print(self.player.sequence) self.player.lose(Bet(self.outcomes[1], bet_amount)) print(self.player.sequence) self.player.lose(Bet(self.outcomes[1], bet_amount)) print(self.player.sequence) self.player.win(Bet(self.outcomes[1], bet_amount)) print(self.player.sequence)
def test_bet_multiple(self): for i in range(4): for i in range(2): self.player.win(Bet(self.outcomes[0], self.player.bet_multiple)) print(self.player.bet_multiple) for j in range(3): self.player.lose( Bet(self.outcomes[1], self.player.bet_multiple)) print(self.player.bet_multiple)
def test_bet_multiple(self): red = Bin(Outcome("Red", 1)) black = Bin(Outcome("Black", 1)) for i in range(4): for i in range(2): self.player.win( Bet(Outcome("Black", 1), self.player.bet_multiple)) print(self.player.bet_multiple) for j in range(3): self.player.lose( Bet(Outcome("Black", 1), self.player.bet_multiple)) print(self.player.bet_multiple)
def place_bets(self): bet_amount = self.base_bet if not self.can_place_bet(bet_amount): return self.table.place_bet(Bet(black, bet_amount)) self.stake -= bet_amount
def __init__(self): """ Player ctor. """ super().__init__() self.__bet = Bet(0) self.__purse = Purse()
def place_bets(self): """Updates the table with a bet on black. The amount bet is bet_multiple""" bet_amount = self.base_bet * self.bet_multiple if not self.can_place_bet(bet_amount): return self.table.place_bet(Bet(MartingalePlayer.outcome, bet_amount)) self.stake -= bet_amount
def place_bets(self): """Creates a bet from the sum of the first and last values of sequence. The first value is at index 0.""" bet_amount = self.bet_amount() bet = Bet(self.outcome, bet_amount) self.table.place_bet(bet) self.stake -= bet.amount
def place_bets(self): """Place a randomly selected bet from all possible outcomes and a fixed bet amount.""" bet_amount = self.base_bet if not self.can_place_bet(bet_amount): return outcome = self._next_outcome() self.table.place_bet(Bet(outcome, bet_amount)) self.stake -= bet_amount return outcome
def test_player_fibonacci(self): bet_amount = 10 self.player.win(Bet(self.outcomes[0], bet_amount)) print(self.player.recent, self.player.previous) self.player.lose(Bet(self.outcomes[1], bet_amount)) print(self.player.recent, self.player.previous) self.player.lose(Bet(self.outcomes[1], bet_amount)) print(self.player.recent, self.player.previous) self.player.win(Bet(self.outcomes[1], bet_amount)) print(self.player.recent, self.player.previous) self.player.lose(Bet(self.outcomes[1], bet_amount)) print(self.player.recent, self.player.previous) self.player.lose(Bet(self.outcomes[1], bet_amount)) print(self.player.recent, self.player.previous) self.player.lose(Bet(self.outcomes[1], bet_amount)) print(self.player.recent, self.player.previous) self.player.win(Bet(self.outcomes[1], bet_amount)) print(self.player.recent, self.player.previous) self.player.win(Bet(self.outcomes[1], bet_amount)) print(self.player.recent, self.player.previous)
def setUp(self): self.bet1 = Bet(Outcome("test1", 2), 100) self.bet2 = Bet(Outcome("test2", 3), 200) self.table1 = Table(250) self.table2 = Table(300)
def test_win_amount(self): bet1 = Bet(self.outcome1, 10) bet2 = Bet(self.outcome2, 20) self.assertEqual(bet1.win_amount(), 20) self.assertEqual(bet2.lose_amount(), 20)
def current_bet(self): """Constructs a bet from the players outcome information. Bet multiplier is 6.""" amount = self.player.base_bet * 6 return Bet(self.player.outcome, amount)