From 177cb04c031257a274a9d583702499ef0a3f1f9c Mon Sep 17 00:00:00 2001 From: zhiyang7 Date: Thu, 23 Dec 2021 09:34:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- douzero/env/env.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/douzero/env/env.py b/douzero/env/env.py index ae5ab30..e6ff0cf 100644 --- a/douzero/env/env.py +++ b/douzero/env/env.py @@ -496,25 +496,25 @@ def _get_obs_landlord(infoset, use_legacy = False, compressed_form = False): my_action_batch[j, :] = _cards2array(action, compressed_form) landlord_up_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord_up'], 25, 15) + infoset.num_cards_left_dict['landlord_up'], 25, 15 if compressed_form else 0) landlord_up_num_cards_left_batch = np.repeat( landlord_up_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) landlord_front_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord_front'], 25, 8) + infoset.num_cards_left_dict['landlord_front'], 25, 8 if compressed_form else 0) landlord_front_num_cards_left_batch = np.repeat( landlord_front_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) landlord_down_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord_down'], 25, 8) + infoset.num_cards_left_dict['landlord_down'], 25, 8 if compressed_form else 0) landlord_down_num_cards_left_batch = np.repeat( landlord_down_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) landlord_up_played_cards = _cards2array( - infoset.played_cards['landlord_up'], 8) + infoset.played_cards['landlord_up'], compressed_form) landlord_up_played_cards_batch = np.repeat( landlord_up_played_cards[np.newaxis, :], num_legal_actions, axis=0) @@ -601,7 +601,7 @@ def _get_obs_landlord_up(infoset, use_legacy = False, compressed_form = False): last_landlord_action[np.newaxis, :], num_legal_actions, axis=0) landlord_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord'], 33, 15) + infoset.num_cards_left_dict['landlord'], 33, 15 if compressed_form else 0) landlord_num_cards_left_batch = np.repeat( landlord_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) @@ -618,7 +618,7 @@ def _get_obs_landlord_up(infoset, use_legacy = False, compressed_form = False): last_teammate_action[np.newaxis, :], num_legal_actions, axis=0) teammate_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord_down'], 25, 8) + infoset.num_cards_left_dict['landlord_down'], 25, 8 if compressed_form else 0) teammate_num_cards_left_batch = np.repeat( teammate_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) @@ -635,7 +635,7 @@ def _get_obs_landlord_up(infoset, use_legacy = False, compressed_form = False): last_teammate_front_action[np.newaxis, :], num_legal_actions, axis=0) teammate_front_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord_front'], 25, 8) + infoset.num_cards_left_dict['landlord_front'], 25, 8 if compressed_form else 0) teammate_front_num_cards_left_batch = np.repeat( teammate_front_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) @@ -722,7 +722,7 @@ def _get_obs_landlord_front(infoset, use_legacy = False, compressed_form = False last_landlord_action[np.newaxis, :], num_legal_actions, axis=0) landlord_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord'], 33, 15) + infoset.num_cards_left_dict['landlord'], 33, 15 if compressed_form else 0) landlord_num_cards_left_batch = np.repeat( landlord_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) @@ -739,7 +739,7 @@ def _get_obs_landlord_front(infoset, use_legacy = False, compressed_form = False last_teammate_action[np.newaxis, :], num_legal_actions, axis=0) teammate_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord_down'], 25, 8) + infoset.num_cards_left_dict['landlord_down'], 25, 8 if compressed_form else 0) teammate_num_cards_left_batch = np.repeat( teammate_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) @@ -756,7 +756,7 @@ def _get_obs_landlord_front(infoset, use_legacy = False, compressed_form = False last_teammate_front_action[np.newaxis, :], num_legal_actions, axis=0) teammate_front_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord_front'], 25, 8) + infoset.num_cards_left_dict['landlord_front'], 25, 8 if compressed_form else 0) teammate_front_num_cards_left_batch = np.repeat( teammate_front_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) @@ -843,7 +843,7 @@ def _get_obs_landlord_down(infoset, use_legacy = False, compressed_form = False) last_landlord_action[np.newaxis, :], num_legal_actions, axis=0) landlord_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord'], 33, 15) + infoset.num_cards_left_dict['landlord'], 33, 15 if compressed_form else 0) landlord_num_cards_left_batch = np.repeat( landlord_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) @@ -860,7 +860,7 @@ def _get_obs_landlord_down(infoset, use_legacy = False, compressed_form = False) last_teammate_action[np.newaxis, :], num_legal_actions, axis=0) teammate_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord_up'], 25, 8) + infoset.num_cards_left_dict['landlord_up'], 25, 8 if compressed_form else 0) teammate_num_cards_left_batch = np.repeat( teammate_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) @@ -877,7 +877,7 @@ def _get_obs_landlord_down(infoset, use_legacy = False, compressed_form = False) last_teammate_front_action[np.newaxis, :], num_legal_actions, axis=0) teammate_front_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord_front'], 25, 8) + infoset.num_cards_left_dict['landlord_front'], 25, 8 if compressed_form else 0) teammate_front_num_cards_left_batch = np.repeat( teammate_front_num_cards_left[np.newaxis, :], num_legal_actions, axis=0) @@ -949,16 +949,16 @@ def _get_obs_general(infoset, position, compressed_form = False): my_action_batch[j, :] = _cards2array(action, compressed_form) landlord_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord'], 33, 15) + infoset.num_cards_left_dict['landlord'], 33, 15 if compressed_form else 0) landlord_up_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord_up'], 25, 8) + infoset.num_cards_left_dict['landlord_up'], 25, 8 if compressed_form else 0) landlord_front_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord_front'], 25, 8) + infoset.num_cards_left_dict['landlord_front'], 25, 8 if compressed_form else 0) landlord_down_num_cards_left = _get_one_hot_array( - infoset.num_cards_left_dict['landlord_down'], 25, 8) + infoset.num_cards_left_dict['landlord_down'], 25, 8 if compressed_form else 0) landlord_played_cards = _cards2array( infoset.played_cards['landlord'], compressed_form)