Vincentzyx / DouZero_For_HLDDZ_FullAuto

将DouZero用于欢乐斗地主自动化
Apache License 2.0
680 stars 168 forks source link

有时候抢到地主会卡住 #15

Open God-phoeniX opened 1 year ago

God-phoeniX commented 1 year ago

如题。有时候抢到地主之后程序就卡住了,无法自动进行接下来的加倍出牌等后续操作。

Moxiner commented 11 months ago

补充说明

问题 / 现象

游戏进程为等待抢地主时,主程序Crash

相关代码

def predict(cards, llc, type="up"):
    print(f"Nets = {Nets} type = {type_(Nets)}")
    net = Nets[type]
    x = torch.flatten(RealToOnehot(cards, llc))
    y = net(x)[0].item()
    return y * 100

推断

推断

相关报错

PS E:\Desktop\DouZero_For_New_HLDDZ> & C:/Users/Moxiner/AppData/Local/Programs/Python/Python38/python.exe e:/Desktop/DouZero_For_New_HLDDZ/main.py
1503.5 809.5
(1650, 994) 进入到游戏中
等待加倍或叫地主
等待加倍或叫地主
等待加倍或叫地主
等待加倍或叫地主
等待加倍或叫地主
等待加倍或叫地主
等待加倍或叫地主
等待加倍或叫地主
jiaodizhu_btn, qiangdizhu_btn, jiabei_btn None (645, 628) None
叫牌预估胜率: 84.80453491210938
712.0 647.0
等待加倍或叫地主
等待加倍或叫地主
等待加倍或叫地主
等待加倍或叫地主
等待加倍或叫地主
等待加倍或叫地主
等待加倍或叫地主
jiaodizhu_btn, qiangdizhu_btn, jiabei_btn None None (504, 626)
叫牌预估胜率: 84.80453491210938
底牌现身。。。
地主牌: 22K

# 此段输出为 Issuer 自行 print(Nets)
Nets = {'up': Net(
  (fc1): Linear(in_features=105, out_features=512, bias=True)
  (fc2): Linear(in_features=512, out_features=512, bias=True)
  (fc3): Linear(in_features=512, out_features=512, bias=True)
  (fc4): Linear(in_features=512, out_features=512, bias=True)
  (fc5): Linear(in_features=512, out_features=512, bias=True)
  (fc6): Linear(in_features=512, out_features=1, bias=True)
  (dropout5): Dropout(p=0.5, inplace=False)
  (dropout3): Dropout(p=0.3, inplace=False)
  (dropout1): Dropout(p=0.1, inplace=False)
), 'down': Net(
  (fc1): Linear(in_features=105, out_features=512, bias=True)
  (fc2): Linear(in_features=512, out_features=512, bias=True)
  (fc3): Linear(in_features=512, out_features=512, bias=True)
  (fc4): Linear(in_features=512, out_features=512, bias=True)
  (fc5): Linear(in_features=512, out_features=512, bias=True)
  (fc6): Linear(in_features=512, out_features=1, bias=True)
  (dropout5): Dropout(p=0.5, inplace=False)
  (dropout3): Dropout(p=0.3, inplace=False)
  (dropout1): Dropout(p=0.1, inplace=False)
)} type = <class 'dict'>

# 主要的 Crash 信息
Traceback (most recent call last):
  File "e:/Desktop/DouZero_For_New_HLDDZ/main.py", line 155, in game_loop
    self.before_start()
  File "e:/Desktop/DouZero_For_New_HLDDZ/main.py", line 853, in before_start
    win_rate = FarmerModel.predict(cards_str, llcards, user_position) - 5
  File "e:\Desktop\DouZero_For_New_HLDDZ\FarmerModel.py", line 110, in predict
    net = Nets[type]
KeyError: 'landlord'