예제 #1
0
    def test1_placebet(self):
        ''' Tests if the bet placed by the player is correctly stored in
            the Table object. '''
        pl = players.Passenger57(self.t)
        pl.setStake(100)

        pl.placeBets()
        self.assertEqual(self.t.bets[0],
                         bet.Bet(10, outcome.Outcome('Black', 1)))
예제 #2
0
    def test2_gather(self):
        ''' Tests the simulator.Simulatogather() method. '''
        
        wh = wheel.Wheel()
        bb = binbuilder.BinBuilder()
        bb.buildBins(wh)
        t = table.Table(100)
        game = roulettegame.RouletteGame(wh, t)        
        pl = players.Passenger57(t)

        sim = simulator.Simulator(pl, game)
예제 #3
0
    def test4_nomorerounds(self):
        nrnd = NonRandom(2)
        wh = wheel.Wheel(nrnd)
        bb = binbuilder.BinBuilder()
        bb.buildBins(wh)
        t = table.Table(100)
        game = roulettegame.RouletteGame(wh, t)
        pl = players.Passenger57(t)
        pl.setStake(100)
        pl.setRounds(10)

        while pl.playing():
            game.cycle(pl)

        self.assertEqual(pl.roundsToGo, 0)
예제 #4
0
    def test1_session(self):
        ''' Tests if the simulator.Simulatosession() returns the required
            list of stakes in a controlled simulation. '''

        nrnd = NonRandom(1)
        wh = wheel.Wheel(nrnd)
        bb = binbuilder.BinBuilder()
        bb.buildBins(wh)
        t = table.Table(100)
        game = roulettegame.RouletteGame(wh, t)        
        pl = players.Passenger57(t)
        sim = simulator.Simulator(pl, game)
        
        self.assertEqual(sim.session(),
                         [90,80,70,60,50,40,30,20,10,0])
예제 #5
0
    def test1_win(self):
        ''' Tests winning process. '''

        nrnd = NonRandom(2)
        wh = wheel.Wheel(nrnd)
        bb = binbuilder.BinBuilder()
        bb.buildBins(wh)
        t = table.Table(100)
        game = roulettegame.RouletteGame(wh, t)
        pl = players.Passenger57(t)
        pl.setStake(100)
        pl.setRounds(10)

        self.assertEqual(pl.stake, 100)
        game.cycle(pl)
        self.assertEqual(pl.stake, 110)
예제 #6
0
    def test3_outofmoney(self):
        ''' Tests if the cycle breaks when the Player's stake is zero '''

        nrnd = NonRandom(1)
        wh = wheel.Wheel(nrnd)
        bb = binbuilder.BinBuilder()
        bb.buildBins(wh)
        t = table.Table(100)
        game = roulettegame.RouletteGame(wh, t)
        pl = players.Passenger57(t)
        pl.setStake(100)
        pl.setRounds(10)

        while pl.playing():
            game.cycle(pl)

        self.assertEqual(pl.stake, 0)