def _extract_state(self, state):
        ''' Encode state

        Args:
            state (dict): dict of original state

        Returns:
            numpy array: 6*5*15 array
                         6 : current hand
                             the union of the other two players' hand
                             the recent three actions
                             the union of all played cards
        '''
        players_pile = state['players_pile']
        hand_rep = encode_cards(state['current_hand'])
        piles_rep = []
        for p in players_pile.keys():
            piles_rep.append(encode_cards(pile2list(players_pile[p])))
        piles_rep = np.array(piles_rep)
        table_rep = encode_cards(state['table'])
        rep = [hand_rep, table_rep]
        rep.extend(piles_rep)
        obs = np.array(rep)

        extracted_state = {'obs': obs, 'legal_actions': self._get_legal_actions()}
        extracted_state['raw_obs'] = state
        extracted_state['raw_legal_actions'] = [a for a in state['action_cards']]
        extracted_state['action_record'] = self.action_recorder

        return extracted_state
 Encode state

        Args:
            state (dict): dict of original state

        Returns:
            numpy array: 6*5*15 array
                         6 : current hand
                             the union of the other two players' hand
                             the recent three actions
                             the union of all played cards
        
rlcard/envs/mahjong.py