Skip to content

Commit

Permalink
shrink doudizhu and remove simple doudizhu
Browse files Browse the repository at this point in the history
Former-commit-id: 3a42285
  • Loading branch information
Daochen Zha committed May 11, 2021
1 parent f7a4050 commit 6db5a57
Show file tree
Hide file tree
Showing 19 changed files with 11 additions and 902 deletions.
5 changes: 0 additions & 5 deletions rlcard/envs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
entry_point='rlcard.envs.doudizhu:DoudizhuEnv',
)

register(
env_id='simple-doudizhu',
entry_point='rlcard.envs.simpledoudizhu:SimpleDoudizhuEnv',
)

register(
env_id='limit-holdem',
entry_point='rlcard.envs.limitholdem:LimitholdemEnv',
Expand Down
1 change: 0 additions & 1 deletion rlcard/envs/doudizhu.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def _extract_state(self, state):
others_hand = _cards2array(state['others_hand'])

last_action = ''
print(state)
if len(state['trace']) != 0:
if state['trace'][-1][1] == 'pass':
last_action = state['trace'][-2][1]
Expand Down
135 changes: 0 additions & 135 deletions rlcard/envs/simpledoudizhu.py

This file was deleted.

Binary file added rlcard/games/doudizhu/jsondata.zip
Binary file not shown.

This file was deleted.

1 change: 0 additions & 1 deletion rlcard/games/doudizhu/jsondata/action_space.json

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

18 changes: 11 additions & 7 deletions rlcard/games/doudizhu/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,28 @@
# Read required docs
ROOT_PATH = rlcard.__path__[0]

if not os.path.isdir(os.path.join(ROOT_PATH, 'games/doudizhu/jsondata')):
import zipfile
with zipfile.ZipFile(os.path.join(ROOT_PATH, 'games/doudizhu/jsondata.zip'),"r") as zip_ref:
zip_ref.extractall(os.path.join(ROOT_PATH, 'games/doudizhu/'))

# Action space
with open(os.path.join(ROOT_PATH, 'games/doudizhu/action_space.txt'), 'r') as f:
action_space_path = os.path.join(ROOT_PATH, 'games/doudizhu/jsondata/action_space.txt')
with open(action_space_path, 'r') as f:
ID_2_ACTION = f.readline().strip().split()
ACTION_2_ID = {}
for i, action in enumerate(ID_2_ACTION):
ACTION_2_ID[action] = i

# a map of action to abstract action
with open(os.path.join(ROOT_PATH, 'games/doudizhu/jsondata/specific_map.json'), 'r') as f:
SPECIFIC_MAP = json.load(f, object_pairs_hook=OrderedDict)

# a map of card to its type. Also return both dict and list to accelerate
with open(os.path.join(ROOT_PATH, 'games/doudizhu/jsondata/card_type.json'), 'r') as f:
card_type_path = os.path.join(ROOT_PATH, 'games/doudizhu/jsondata/card_type.json')
with open(card_type_path, 'r') as f:
data = json.load(f, object_pairs_hook=OrderedDict)
CARD_TYPE = (data, list(data), set(data))

# a map of type to its cards
with open(os.path.join(ROOT_PATH, 'games/doudizhu/jsondata/type_card.json'), 'r') as f:
type_card_path = os.path.join(ROOT_PATH, 'games/doudizhu/jsondata/type_card.json')
with open(type_card_path, 'r') as f:
TYPE_CARD = json.load(f, object_pairs_hook=OrderedDict)

# rank list of solo character of cards
Expand Down
5 changes: 0 additions & 5 deletions rlcard/games/simpledoudizhu/__init__.py

This file was deleted.

92 changes: 0 additions & 92 deletions rlcard/games/simpledoudizhu/dealer.py

This file was deleted.

Loading

0 comments on commit 6db5a57

Please sign in to comment.