submit-paper / Danzero_plus

33 stars 7 forks source link

How to run the game #6

Open StevenUST opened 10 months ago

StevenUST commented 10 months ago

Now I am try to run the game (i.e., 4 players are playing guandan).

I have read the game.py file in actor_n and I try to start running it. However, there is no connection. There should be a server port to connect these four players so that they can play the game. But how can I start the server and connect these clients in game.py?

submit-paper commented 10 months ago

Well, I don't know what you did when running the code. If you just to start the training, please refer to the shell file in our project. If you just want to run the guandan game, you should first start the game core and run the code for each player. Maybe you can refer to the code in ./wintest, where offers clear examples for local running. As ti the server port, if you run the project in the same docker, there should be no need to set the port.

StevenUST commented 10 months ago

Well, I don't know what you did when running the code. If you just to start the training, please refer to the shell file in our project. If you just want to run the guandan game, you should first start the game core and run the code for each player. Maybe you can refer to the code in ./wintest, where offers clear examples for local running. As ti the server port, if you run the project in the same docker, there should be no need to set the port.

Now I run the server and I try to run the code in ./wintest. However, there is a file that I cannot find:

in ./wintest/torch/actor.py, a file with suffix 'pth' is opened. However, where can I find such file? Or I need to train a model and play the game?

class Player(): def init(self, args) -> None:

模型初始化

    self.model_id = args.iter * 2000 + 500
    self.model = MLPActorCritic((ActionNumber, 516+ActionNumber * 54), ActionNumber)
    with open('./models/ppo{}.pth'.format(self.model_id), 'rb') as f:
        new_weights = CPU_Unpickler(f).load()
    print('load model:', self.model_id)
    self.model.set_weights(new_weights)
    self.model_q = MLPQNetwork(567)
    with open('./q_network.ckpt', 'rb') as f:
        tf_weights = pickle.load(f)
    self.model_q.load_tf_weights(tf_weights)
submit-paper commented 10 months ago

Yes, you may need to train a model to play this game. Whereas, if you just want to execute the evaluation, you can try the heuristic rules and we also provide ai1~ai8 in the project.

StevenUST commented 10 months ago

Yes, you may need to train a model to play this game. Whereas, if you just want to execute the evaluation, you can try the heuristic rules and we also provide ai1~ai8 in the project.

Thanks for your reply. In my undertanding, the learner.py in learner_torch file is used for training. However, what are the steps for training a new model? Also, I cannot setup docker in my computer due to some technical issues. Is it fine to train a model without using docker?