Пример #1
0
    def test_rainbow_display(self):
        p = Player(players[0])
        p.hand = [Card('rainbow', i, b) for i, b in zip(xrange(1,6), uppercase[:5])]
        m = xterm_markup()
        print m.color('hello world', xterm_markup.RAINBOW)

        self.game = Game()
        self.game.markup = m
        for p in players:
            self.game.add_player(p)

        for c in self.game.deck:
            c.markup = xterm_markup()

        self.game.start_game(players[0], opts={'rainbow_10': True})
        self.game.turn_order = list(players)
        for n, l in [(1, 'A'), (2, 'B'), (3, 'C')]:
            c = Card(text_markup_base.RAINBOW, n, l)
            c.markup = self.game.markup
            self.game._players[self.game.player_turn()].hand[n-1] = c
        self.game.play_card(self.game.player_turn(), 'A')
        self.game.play_card(self.game.player_turn(), 'A')
        print self.game.play_card(self.game.player_turn(), 'B')
Пример #2
0
    def test_unsolvable_rainbow_5(self):
        game = Game()
        game.markup = xterm_markup()
        for p in players:
            game.add_player(p)

        for c in game.deck:
            c.markup = xterm_markup()

        opts = {'rainbow_5': True}
        game.options['solvable_rainbow_5'] = True
        bad_card = Card('rainbow', 1)
        bad_card.markup = xterm_markup()
        game.deck[len(game.deck)-1] = bad_card
        
        last_card = game.deck[len(game.deck)-1]
        print '\nlast card before: %s' % last_card

        game.start_game(players[0], opts)
        
        last_card = game.deck[len(game.deck)-1]
        print 'last card after: %s' % last_card
        self.assertFalse(last_card.color == 'rainbow' and 
                         last_card.number in [1,2,3,4])