From dc45da771c4034246ef806ca36a6c038dc16c201 Mon Sep 17 00:00:00 2001 From: Vincentzyx <929403983@qq.com> Date: Wed, 3 Nov 2021 15:56:28 +0800 Subject: [PATCH] =?UTF-8?q?AI=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复了不能管顺子的bug,并且优化了resnet模型的性能。 --- douzero/env/game.py | 26 +++++++++++++------------- main.py | 13 +++++++++---- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/douzero/env/game.py b/douzero/env/game.py index 46896b7..813641a 100644 --- a/douzero/env/game.py +++ b/douzero/env/game.py @@ -58,10 +58,10 @@ class GameEnv(object): self.bomb_num = 0 self.last_pid = 'landlord' - self.bid_info = [[-1, -1, -1], - [-1, -1, -1], - [-1, -1, -1], - [-1, -1, -1]] + self.bid_info = [[1, 1, 1], + [1, 1, 1], + [1, 1, 1], + [1, 1, 1]] self.bid_count = 0 self.multiply_count = {'landlord': 1, 'landlord_up': 1, @@ -339,10 +339,10 @@ class GameEnv(object): self.bomb_num = 0 self.last_pid = 'landlord' - self.bid_info = [[-1, -1, -1], - [-1, -1, -1], - [-1, -1, -1], - [-1, -1, -1]] + self.bid_info = [[1, 1, 1], + [1, 1, 1], + [1, 1, 1], + [1, 1, 1]] self.bid_count = 0 self.multiply_count = {'landlord': 0, 'landlord_up': 0, @@ -445,11 +445,11 @@ class InfoSet(object): # The number of bombs played so far self.bomb_num = None - self.bid_info = [[-1, -1, -1], - [-1, -1, -1], - [-1, -1, -1], - [-1, -1, -1]] + self.bid_info = [[1, 1, 1], + [1, 1, 1], + [1, 1, 1], + [1, 1, 1]] - self.multiply_info = [1, 0, 0] + self.multiply_info = [1, 1, 1] self.player_id = None diff --git a/main.py b/main.py index dc39483..6ac93d1 100644 --- a/main.py +++ b/main.py @@ -74,12 +74,13 @@ class MyPyQT_Form(QtWidgets.QWidget, Ui_Form): self.SleepTime = 0.1 # 循环中睡眠时间 self.RunGame = False self.AutoPlay = False - self.BidThreshold1 = 65 # 叫地主阈值 - self.BidThreshold2 = 75 # 抢地主阈值 + self.BidThreshold1 = 65 # 叫地主阈值 + self.BidThreshold2 = 72 # 抢地主阈值 self.JiabeiThreshold = ( - (80, 65), # 叫地主 超级加倍 加倍 阈值 - (85, 70) # 叫地主 超级加倍 加倍 阈值 (在地主是抢来的情况下) + (85, 72), # 叫地主 超级加倍 加倍 阈值 + (85, 75) # 叫地主 超级加倍 加倍 阈值 (在地主是抢来的情况下) ) + self.MingpaiThreshold = 92 # 坐标 self.MyHandCardsPos = (250, 764, 1141, 70) # 我的截图区域 self.LPlayedCardsPos = (463, 355, 380, 250) # 左边截图区域 @@ -286,6 +287,7 @@ class MyPyQT_Form(QtWidgets.QWidget, Ui_Form): self.other_played_cards_real = "" print("\n下家出牌:", self.other_played_cards_real) self.other_played_cards_env = [RealCard2EnvCard[c] for c in list(self.other_played_cards_real)] + self.other_played_cards_env.sort() self.env.step(self.user_position, self.other_played_cards_env) # 更新界面 self.RPlayedCard.setText(self.other_played_cards_real if self.other_played_cards_real else "不出") @@ -316,6 +318,7 @@ class MyPyQT_Form(QtWidgets.QWidget, Ui_Form): self.other_played_cards_real = "" print("\n上家出牌:", self.other_played_cards_real) self.other_played_cards_env = [RealCard2EnvCard[c] for c in list(self.other_played_cards_real)] + self.other_played_cards_env.sort() self.env.step(self.user_position, self.other_played_cards_env) self.play_order = 0 # 更新界面 @@ -559,6 +562,8 @@ class MyPyQT_Form(QtWidgets.QWidget, Ui_Form): self.sleep(7000) else: self.sleep(2000) + if win_rate > self.MingpaiThreshold: + helper.ClickOnImage("mingpai_btn", region=self.GeneralBtnPos) self.init_cards()