def step(self, state):
        ''' Predict the action given raw state. A naive rule.
        Args:
            state (dict): Raw state from the game

        Returns:
            action (str): Predicted action
        '''
        state = state['raw_obs']
        trace = state['trace']
        # the rule of leading round
        if len(trace) == 0 or (len(trace) >= 3 and trace[-1][1] == 'pass' and trace[-2][1] == 'pass'):
            comb = self.combine_cards(state['current_hand'])
            min_card = state['current_hand'][0]
            for _, actions in comb.items():
                for action in actions:
                    if min_card in action:
                        return action
        # the rule of following cards
        else:
            target = state['trace'][-1][-1]
            target_player = state['trace'][-1][0]
            if target == 'pass':
                target = state['trace'][-2][-1]
                target_player = state['trace'][-1][0]
            the_type = CARD_TYPE[0][target][0][0]
            chosen_action = ''
            rank = 1000
            for action in state['actions']:
                if action != 'pass' and the_type == CARD_TYPE[0][action][0][0]:
                    if int(CARD_TYPE[0][action][0][1]) < rank:
                        rank = int(CARD_TYPE[0][action][0][1])
                        chosen_action = action
            if chosen_action != '':
                return chosen_action
            landlord = state['landlord']
            if target_player != landlord and state['self'] != landlord:
                return 'pass'
            return np.random.choice(state['actions'])
 Predict the action given raw state. A naive rule.
        Args:
            state (dict): Raw state from the game

        Returns:
            action (str): Predicted action
        
rlcard/models/doudizhu_rule_models.py