def test_joker_kickers(self): hand = CardSet( Counter({ Card.THREE: 3, Card.FOUR: 3, Card.LITTLE_JOKER: 1, Card.BIG_JOKER: 1 })) self.assertEqual(len(hand.get_all_moves()), 17)
def test_complex(self): hand = CardSet( Counter({ Card.THREE: 3, Card.FOUR: 1, Card.FIVE: 2, Card.SIX: 1, Card.SEVEN: 1, Card.LITTLE_JOKER: 1, Card.BIG_JOKER: 1 })) self.assertTrue(len(hand.get_all_moves()) == 19)
def get_legal_moves(self): if self.is_betting_complete(): hand = CardSet(Counter(self.get_hand(self.get_current_position()))) all_moves = hand.get_all_moves() # you can play anything if you have control if self._control_position == self.get_current_position(): return all_moves # otherwise you have to play moves that beat it, or pass return [move for move in all_moves if move.beats(self.get_last_played())] + [None] else: return [BetMove(x) for x in range(LandlordGame.MAX_BET + 1)]