示例#1
0
    def test_melding_3(self):  # 2020-Apr-19
        hand_text = [
            '7H', '6H', '5H', '4S', '4H', '3H', '2S', 'AS', 'AH', 'AD', 'AC'
        ]
        hand = [utils.card_from_text(x) for x in hand_text]
        going_out_deadwood_count = 10
        knock_cards, gin_cards = judge.get_going_out_cards(
            hand=hand, going_out_deadwood_count=going_out_deadwood_count)

        player = GinRummyPlayer(player_id=0, np_random=np.random.RandomState())
        player.hand = hand
        player.did_populate_hand()
        meld_clusters = player.get_meld_clusters()
        alpha, beta = judge._get_going_out_cards(
            meld_clusters=meld_clusters,
            hand=hand,
            going_out_deadwood_count=going_out_deadwood_count)
        self.assertEqual(set(alpha), set(knock_cards))
        self.assertEqual(beta, [])

        correct_knock_cards = [
            utils.card_from_text(x)
            for x in ['7H', '4S', '4H', '3H', '2S', 'AS', 'AH', 'AD', 'AC']
        ]
        self.assertEqual(set(knock_cards), set(correct_knock_cards))
        self.assertEqual(gin_cards, [])
示例#2
0
    def test_melding_3(self):  # 2020-Apr-19
        hand_text = [
            '7H', '6H', '5H', '4S', '4H', '3H', '2S', 'AS', 'AH', 'AD', 'AC'
        ]
        hand = [utils.card_from_text(x) for x in hand_text]
        going_out_deadwood_count = 10
        knock_cards, gin_cards = judge.get_going_out_cards(
            hand=hand, going_out_deadwood_count=going_out_deadwood_count)

        player = GinRummyPlayer(player_id=0)
        player.hand = hand
        player.did_populate_hand()
        meld_clusters = player.get_meld_clusters()
        alpha, beta = judge._get_going_out_cards(
            meld_clusters=meld_clusters,
            hand=hand,
            going_out_deadwood_count=going_out_deadwood_count)
        assert set(alpha) == set(knock_cards)
        assert beta == []

        correct_knock_cards = [
            utils.card_from_text(x)
            for x in ['7H', '4S', '4H', '3H', '2S', 'AS', 'AH', 'AD', 'AC']
        ]
        assert set(knock_cards) == set(correct_knock_cards)
        assert gin_cards == []