Beispiel #1
0
 def setUp(self):
   self.bet = Bet(1, EvenMoney("Black"))
   self.mock_player = Mock()
   self.table = Table(0, 1)
   self.mock_wheel = Mock()
   self.mock_wheel.next.return_value = set()
   self.game = Game(self.table, self.mock_wheel)
Beispiel #2
0
 def setUp(self):
   """Setup a basic Simulator with the Martingale Player."""
   self.table = Table(0, 100)
   self.wheel = Wheel()
   self.game = Game(self.table, self.wheel)
   self.player = Martingale(self.table, self.wheel)
   self.simulator = Simulator(self.game, self.player)
Beispiel #3
0
def main(argv=None):
  """Application main function: setup a simulation, print results."""
  table = Table(1, 100)
  wheel = Wheel()
  game = Game(table, wheel)
  player = Martingale(table, wheel)
  sim = Simulator(game, player)
  sim.gather()
  print("durations", sim.durations, "\n", "maxima", sim.maxima)
Beispiel #4
0
 def test_table_isValid_total_table_limit(self):
   """Sum of all Bets should be less or equal to the Table limit."""
   table = Table(0, 10)
   # invalid Bet (total table bets more than limit)
   table.placeBet(Bet(11, EvenMoney("High")))
   self.assertRaises(InvalidBet, table.isValid)
Beispiel #5
0
 def test_table_isValid_minimum_bet_amount(self):
   """Each Bet should be greater or equal to the Table minimum."""
   table = Table(10, 1000)
   # invalid Bet (amountBet less than Table minimum)
   table.placeBet(Bet(1, EvenMoney("Black")))
   self.assertRaises(InvalidBet, table.isValid)
Beispiel #6
0
 def test_table_isValid_valid_table(self):
   """A valid Table should be a valid."""
   table = Table(1, 10)
   table.placeBet(Bet(1, EvenMoney("Red")))
   table.placeBet(Bet(2, EvenMoney("Black")))
   self.assertTrue(table.isValid())
Beispiel #7
0
 def test_table_isValid_empty_table(self):
   """An empty Table should be valid."""
   table = Table(0, 1)
   self.assertTrue(table.isValid())
Beispiel #8
0
 def setUp(self):
   self.outcome = EvenMoney("Red")
   self.table = Table(0, 10)
Beispiel #9
0
 def setUp(self):
     self.table = Table(0, 1)
     self.player = Player(self.table)
Beispiel #10
0
def test_not_playing_if_no_rounds_left(self, player):
    """A Player should not be playing if there are no roundsToGo left."""
    player.table = Table(0, 1)
    player.roundsToGo = 0
    self.assertFalse(player.playing())
Beispiel #11
0
def test_stake_required_to_play(self, player):
    """A Player with stake below Table minimum should not be playing."""
    player.table = Table(10, 100)
    player.stake = 9
    self.assertFalse(player.playing())