def test_cards_without_suit(self): test_cards = [ Card.new('3s'), Card.new('3h'), Card.new('3d'), Card.new('3c'), Card.new('10c'), Card.new('10d'), Card.new('10h'), Card.new('10s'), Card.new('BJ'), Card.new('CJ'), ] ret = Card.cards_without_suit(test_cards) self.assertEqual(ret, '3-3-3-3-10-10-10-10-BJ-CJ')
def test_doudizhu_greater_cards(self): cards_x = [ Card.new('10c'), Card.new('10d'), Card.new('10h'), Card.new('CJ'), ] cards_y = [ Card.new('Kc'), Card.new('Kd'), Card.new('Kh'), Card.new('3s'), ] ret = doudizhu.cards_greater(cards_x, cards_y) self.assertEqual(ret[0], False) ret = doudizhu.cards_greater(cards_y, cards_x) self.assertEqual(ret[0], True)
def test_doudizhu_check_card_type(self): test_cards = [ Card.new('10c'), Card.new('10d'), Card.new('10h'), Card.new('10s'), Card.new('BJ'), Card.new('CJ'), ] ret = doudizhu.check_card_type(test_cards) self.assertEqual(ret[0], True)
def CardStrListToCardIntSet(cards): return set([Card.new(card_str) for card_str in cards])
def CardStrListToCardIntList(cards): return [Card.new(card_str) for card_str in cards]