This commit is contained in:
ZaneYork 2021-12-28 19:48:01 +08:00
parent 0c3abc98c1
commit aa3c5a018b
1 changed files with 9 additions and 4 deletions

View File

@ -158,9 +158,10 @@ def predict():
return jsonify({'status': 7, 'message': 'the number of the other hand cards do not align with the number of cards left'}) return jsonify({'status': 7, 'message': 'the number of the other hand cards do not align with the number of cards left'})
# Last moves # Last moves
last_moves = [] last_move_dict = {'landlord': [RealCard2EnvCard[c] for c in request.form.get('last_move_landlord')],
for field in ['last_move_landlord', 'last_move_landlord_down', 'last_move_landlord_front', 'last_move_landlord_up']: 'landlord_up': [RealCard2EnvCard[c] for c in request.form.get('last_move_landlord_up')],
last_moves.append([RealCard2EnvCard[c] for c in request.form.get(field)]) 'landlord_front': [RealCard2EnvCard[c] for c in request.form.get('last_move_landlord_front')],
'landlord_down': [RealCard2EnvCard[c] for c in request.form.get('last_move_landlord_down')]}
# Played cards # Played cards
played_cards = {} played_cards = {}
@ -177,7 +178,7 @@ def predict():
info_set.num_cards_left = num_cards_left info_set.num_cards_left = num_cards_left
info_set.card_play_action_seq = card_play_action_seq info_set.card_play_action_seq = card_play_action_seq
info_set.other_hand_cards = other_hand_cards info_set.other_hand_cards = other_hand_cards
info_set.last_moves = last_moves info_set.last_move_dict = last_move_dict
info_set.played_cards = played_cards info_set.played_cards = played_cards
info_set.bomb_num = [int(x) for x in str.split(bomb_num, ',')] info_set.bomb_num = [int(x) for x in str.split(bomb_num, ',')]
info_set.num_cards_left_dict['landlord'] = num_cards_left[0] info_set.num_cards_left_dict['landlord'] = num_cards_left[0]
@ -258,6 +259,10 @@ class InfoSet(object):
self.other_hand_cards = None self.other_hand_cards = None
self.legal_actions = None self.legal_actions = None
self.last_move = None self.last_move = None
self.last_move_dict = {'landlord': [],
'landlord_up': [],
'landlord_front': [],
'landlord_down': []}
self.last_moves = None self.last_moves = None
self.played_cards = None self.played_cards = None
self.bomb_num = None self.bomb_num = None