Esempio n. 1
0
 def test_hand_triple_straights_none(self):
     """tests get valid low triple straight"""
     c = None
     each_count = 3
     length = 2
     play = self.hand_adj_trip.get_low_straight(c, each_count, length)
     _check_straight(play.cards, 3)
     _print_card_list(play)
Esempio n. 2
0
 def test_hand_double_straights_none(self):
     """tests get valid low double straight"""
     c = None
     each_count = 2
     length = 3
     play = self.hand.get_low_straight(c, each_count, length)
     _check_straight(play.cards, 2)
     _print_card_list(play)
Esempio n. 3
0
 def test_hand_single_straights_none(self):
     """tests get valid low single straight"""
     c = None
     each_count = 1
     length = 5
     play = self.hand.get_low_straight(c, each_count, length)
     _check_straight(play.cards, 1)
     _print_card_list(play)
Esempio n. 4
0
 def test_hand_triple_straights_valid(self):
     """tests get valid low triple straight"""
     c = card.Card('4', 'h')
     each_count = 3
     length = 2
     play = self.hand_adj_trip.get_low_straight(c, each_count, length)
     _check_straight(play.cards, 3)
     assert play.num_cards() == length * each_count
     assert play.get_base_card() > c
     _print_card_list(play, extra_msg="greater than {}".format(str(c)))
Esempio n. 5
0
 def test_ai_get_best_double_straight(self):
     card_strs = [
         '6h', '6c', '6s', '7s', '7d', '7c', '8d', '8h', '9H', '9D', '0H',
         '0S', 'Js', 'Qd', 'KD', 'KC', '2C'
     ]
     player = TestAIPlayer.generate_ai_from_card_strs(card_strs)
     prev_play = Play(2, [
         Card('3', 'h'),
         Card('3', 'd'),
         Card('4', 'c'),
         Card('4', 's'),
         Card('5', 's'),
         Card('5', 'c')
     ],
                      0,
                      play_type=DOUBLE_STRAIGHTS)
     self.setup_game_state([prev_play])
     best_play = player.get_best_double_straights(self.game_state)
     assert best_play[0].name == '8'
     _check_straight(best_play.cards, 2)
Esempio n. 6
0
    def test_ai_get_best_single_straight(self):
        card_strs = [
            '3c', '3d', '4s', '6h', '6d', '6c', '7h', '7d', '9c', '0s', 'Jd',
            'Qc', 'Qs', 'Kd', 'Ac', 'Ah', 'Z0'
        ]
        player = TestAIPlayer.generate_ai_from_card_strs(card_strs)

        prev_play = Play(2, [
            Card('3', 'h'),
            Card('4', 'd'),
            Card('5', 'c'),
            Card('6', 's'),
            Card('7', 's')
        ],
                         0,
                         play_type=STRAIGHTS)
        self.setup_game_state([prev_play])
        best_play = player.get_best_straights(self.game_state)
        assert best_play[0].name == '9'
        _check_straight(best_play.cards, 1)