示例#1
0
    def test_mock_play_whole_deck(self):
        random.seed(0)
        s2 = sorry.strategy(self.g)
        p2 = sorry.player("Joe", "GREEN", s2)
        s2.set_player(p2)
        self.g._players = [self.p, p2]
        deck = [
            sorry.card1(),
            sorry.card2(),
            sorry.card3(),
            sorry.card4(),
            sorry.card5(),
            sorry.card7(),
            sorry.card8(),
            sorry.card10(),
            sorry.card11(),
            sorry.cardsorry(),
            sorry.card12()
        ]
        for i in xrange(161):
            card1 = deck[random.randint(0, len(deck) - 1)]
            card2 = deck[random.randint(0, len(deck) - 1)]
            s2.apply(card1)
            print card1
            print p2.positions()
            self.s.apply(card2)
            print card2
            print self.p.positions()

        self.assertTrue(self.p.is_win())
        self.assertTrue(p2.is_win())
示例#2
0
 def test_move_11_strategy_1(self):
     card = sorry.card11()
     card1 = sorry.card1()
     s2 = sorry.strategy(self.g)
     p2 = sorry.player("Joe", "GREEN", s2)
     s2.set_player(p2)
     s2._player._pawns[0].position = 32
     self.g._players = [self.p, p2]
     self.s.apply(card1)
     self.s.apply(card)
     self.assertEqual(self.s._player.pawns[0].position, 32)
     self.assertEqual(s2._player.pawns[0].position, 3)
示例#3
0
 def test_move_11_strategy_3(self):
     card = sorry.card11()
     self.s.apply(card)
     self.assertEqual(self.p.pawns[0].position, -1)
示例#4
0
 def test_card11_2(self):
     c = sorry.card11()
     c.apply(self.p1, self.p3, "EXCHANGE", self.b)
     self.assertEqual(self.p1.position, 43)
     self.assertEqual(self.p3.position, 3)
示例#5
0
 def test_card11_1(self):
     c = sorry.card11()
     c.apply(self.p1, None, "FORWARD", self.b)
     self.assertEqual(self.p1.position, 14)