diff --git a/pve_server/run_dmc.py b/pve_server/run_dmc.py index 957f27c..2f73727 100644 --- a/pve_server/run_dmc.py +++ b/pve_server/run_dmc.py @@ -1,4 +1,6 @@ import os +import itertools + import torch import numpy as np from heapq import nlargest @@ -323,6 +325,9 @@ def _get_legal_card_play_actions(player_hand_cards, rival_move): for m in moves: m.sort() + moves.sort() + moves = list(move for move,_ in itertools.groupby(moves)) + return moves Card2Column = {'3': 0, '4': 1, '5': 2, '6': 3, '7': 4, '8': 5, '9': 6, 'T': 7, diff --git a/pve_server/run_douzero.py b/pve_server/run_douzero.py index b4bd9a6..e8e1869 100644 --- a/pve_server/run_douzero.py +++ b/pve_server/run_douzero.py @@ -1,3 +1,5 @@ +import itertools + from flask import Flask, jsonify, request from flask_cors import CORS @@ -237,6 +239,9 @@ def _get_legal_card_play_actions(player_hand_cards, rival_move): for m in moves: m.sort() + moves.sort() + moves = list(move for move,_ in itertools.groupby(moves)) + return moves if __name__ == '__main__':