def resetParam(self): ''' 重开发牌 ''' # 玩家手牌 self.handStack = [[], [], [], []] # 牌河 self.riverStack = [[], [], [], []] # 鸣牌区域 self.fuluStack = [[], [], [], []] # 随机生成新牌堆 self.yama = PaiMaker.GeneratePai() # 牌顶位置 self.yamaPos = -1 # 杠牌位置 self.yamaLast = 135 # 宝牌位置 self.baoPos = 130 # 翻开第一张宝牌 (宝牌倒着开) self.bao = [self.yama[self.baoPos]] self.libao = [self.yama[self.baoPos + 1]] # 下个宝牌 self.baoPos -= 2 # 4家立直 self.playerLizhi = [0, 0, 0, 0] # 4家巡数 self.xunshu = [0, 0, 0, 0] # 首巡 self.diyizimo = [True, True, True, True] # 振听状态 self.zhenting = [False, False, False, False] # 杠后牌 self.gangflag = False # 一发状态 self.yifa = [False, False, False, False] # 点数分配 self.realfenpei = [0, 0, 0, 0] # 当前轮到的玩家 self.curWind = 0 # 单局结束 self.endSection = False # 是否连庄 self.lianzhuang = False # 终庄指示 self.endGame = False
t = opt[action]['type'] if(t == 5): dic['type'] = 'chipenggang' else: dic['type'] = 'angangjiagang' combination = opt[action]['combination'] dic['combination'] = [combination, t] elif(action == 40): print(opt[action]) t = opt[action]['type'] dic['tile'] = opt[action]['combination'] if(t == 8): dic['type'] = 'hu' elif(t == 9): dic['type'] = 'zimo' elif(action == 41): pass return dic if __name__ == "__main__": vis = False print(len(sys.argv)) if len(sys.argv) > 1: # vis = True pass env = Environment(rule=Rule(),yama=PaiMaker.GeneratePai(1)) RL = QLearningTable(actions=list(range(41))) update() # env.after(100, update) # env.mainloop()