示例#1
0
 def test_hand_get_low_triple_double_none(self):
     """tests get low triple double where other card is None"""
     c = None
     each_count = 3
     extra = 2
     play = self.hand_adj_trip.get_low(c, each_count, extra=extra)
     _check_triple(play.cards)
     assert play.num_cards() == 5
     _print_card_list(play)
示例#2
0
 def test_ai_get_best_triples_alone(self):
     prev_play = Play(
         2, [Card('J', 'h'), Card('J', 'd'),
             Card('J', 'c')],
         0,
         play_type=TRIPLES)
     self.setup_game_state([prev_play])
     best_play = self.test_ai_player_lv3.get_best_triples(self.game_state)
     assert best_play[0].name == 'Q'
     _check_triple(best_play.cards)
示例#3
0
 def test_hand_get_low_triple_double_valid(self):
     """tests get low on a valid triple double"""
     c = card.Card('3', 'h')
     each_count = 3
     extra = 2
     play = self.hand_adj_trip.get_low(c, each_count, extra=extra)
     assert play.get_base_card() > c
     assert play.num_cards() == 5
     _check_triple(play.cards)
     _print_card_list(play, extra_msg="greater than {}".format(str(c)))
示例#4
0
    def test_ai_get_best_triples_double(self):
        card_strs = [
            '3c', '3d', '6h', '6s', '6d', '6c', '7h', '7d', '7c', '8s', '9d',
            '0c', 'Qs', 'Kd', 'Ac', '2h', 'Z0'
        ]
        player = TestAIPlayer.generate_ai_from_card_strs(card_strs)

        prev_play = Play(2, [
            Card('5', 'h'),
            Card('5', 'd'),
            Card('5', 'c'),
            Card('4', 'c'),
            Card('4', 's')
        ],
                         2,
                         play_type=TRIPLES)
        self.setup_game_state([prev_play])
        best_play = player.get_best_triples(self.game_state)
        assert best_play[0].name == '7'
        assert best_play[3].name == '3'
        _check_triple(best_play.cards)