''' Created on Jul 2, 2012 @author: Cam Moore ''' from cam.CrapsGame import CrapsGame from cam.Betting import Betting from statlib import stats if __name__ == '__main__': game = CrapsGame() across = Betting(game) six_eight = Betting(game) come = Betting(game) stake1 = 100 stake2 = 100 stake3 = 100 line_bet = 5 line_odds = 10 atm1 = 0 atm2 = 0 atm3 = 0 stakes1 = [] stakes2 = [] stakes3 = [] atms1 = [] atms2 = [] atms3 = [] profits1 = [] profits2 = []
''' Created on Jul 2, 2012 @author: Cam Moore ''' from cam.CrapsGame import CrapsGame from cam.Betting import Betting from statlib import stats if __name__ == '__main__': g = CrapsGame() b = Betting(g) stake = 100 line_bet = 5 line_odds = 10 atm = 0 stakes = [] atms = [] profits = [] debug = False for j in range(1, 10): stake = 100 atm = 0 for i in range(1, 50): # Do the banking first if stake < line_bet: # need more money stake += 100 atm += 100 if stake > 250: # deposit some of our winnings
class TestBetting(unittest.TestCase): def setUp(self): self.betting = Betting(CrapsGame()) def testSimple(self): self.betting.play_pass_line(5) self.betting.game.roll_dice(d1_val=4, d2_val=3) self.assertTrue(self.betting.game.is_seven(), "msg") self.assertEqual(10, self.betting.check_winnings(), "msg") self.assertFalse(self.betting.play_come_bet(5), "msg") self.assertEqual(10, self.betting.check_winnings(), "msg") def testPassLine(self): self.betting.play_pass_line(5) self.betting.game.roll_dice(d1_val=4, d2_val=3) self.assertEqual(10, self.betting.check_winnings(), "got %s not 10" % self.betting.check_winnings()) self.betting.play_pass_line(5) self.betting.game.roll_dice(d1_val=4, d2_val=2) self.betting.play_pass_line_odds(10) self.betting.game.roll_dice(d1_val=4, d2_val=2) self.assertEqual(5 + 5 + 10 + 12, self.betting.check_winnings(), "32 != %s" % self.betting.check_winnings()) def testCraps(self): self.betting.play_pass_line(5) self.betting.game.roll_dice(d1_val=1, d2_val=2) self.assertTrue(self.betting.game.is_craps(), "msg") self.assertEqual(0, self.betting.check_winnings(), "msg") self.assertEqual(0, self.betting.pass_line_bet, "msg") def testPlaceBets(self): self.betting.play_pass_line(5) self.betting.game.roll_dice(d1_val=1, d2_val=5) self.betting.place_the_number(8, 6) self.betting.game.roll_dice(d1_val=5, d2_val=3) self.assertEqual(7, self.betting.check_winnings(), "msg") def testComeBets(self): self.betting.play_pass_line(5) self.betting.game.roll_dice(verbose=True, d1_val=1, d2_val=5) self.betting.play_pass_line_odds(10) self.betting.play_come_bet(5) self.betting.game.roll_dice(verbose=True, d1_val=2, d2_val=5) self.assertEqual(10, self.betting.check_winnings(), "msg") self.assertFalse(self.betting.play_come_bet(5), "msg") self.assertEqual(0, self.betting.num_come_bets(), "expecting 0 got %s" % self.betting.num_come_bets()) self.betting.game.roll_dice(verbose=True, d1_val=1, d2_val=5) self.assertEqual(0, self.betting.check_winnings(), "msg") self.assertTrue(self.betting.play_come_bet(5), "msg") self.betting.game.roll_dice(verbose=True, d1_val=1, d2_val=3) self.assertEqual(0, self.betting.check_winnings(), "msg") self.assertEqual(1, self.betting.num_come_bets(), "expected 1 got %s" % self.betting.num_come_bets()) self.assertTrue(self.betting.play_come_bet_odds(4, 10), "msg") self.betting.game.roll_dice(verbose=True, d1_val=2, d2_val=2) self.assertEqual(40, self.betting.check_winnings(verbose=True), "expected 40 got %s" % self.betting.check_winnings()) def testPlaceAndPass(self): self.betting.play_pass_line(5) self.betting.game.roll_dice(verbose=True, d1_val=1, d2_val=5) self.betting.check_winnings(verbose=True) self.betting.play_pass_line_odds(10) self.betting.place_the_number(4, 5) self.betting.place_the_number(5, 5) self.betting.place_the_number(8, 6) self.betting.place_the_number(9, 5) self.betting.place_the_number(10, 5) self.betting.game.roll_dice(verbose=True, d1_val=1, d2_val=4) self.betting.check_winnings(verbose=True) self.betting.game.roll_dice(verbose=True, d1_val=2, d2_val=4) self.assertEqual(32, self.betting.check_winnings(verbose=True), "got %s" % self.betting.check_winnings())
def setUp(self): self.betting = Betting(CrapsGame())
""" Created on Jul 2, 2012 @author: Cam Moore """ from cam.CrapsGame import CrapsGame from cam.Betting import Betting from statlib import stats if __name__ == "__main__": g = CrapsGame() b = Betting(g) stake = 100 line_bet = 5 line_odds = 10 atm = 0 stakes = [] atms = [] profits = [] debug = True for j in range(1, 2): stake = 100 atm = 0 num_come_bets = 0 for i in range(1, 50): # Do the banking first if stake < line_bet: # need more money stake += 100 atm += 100