def shuffle(self, goodPointCount, handTileCount): """ 洗牌器 子类里可添加特殊逻辑,比如确定宝牌 """ if self.tileTestMgr.initTiles(): # 检查手牌 handTiles = self.tileTestMgr.handTiles poolTiles = self.tileTestMgr.tiles ftlog.debug("self.tiles len1 = ", len(self.__tiles), "poolTiles = ", poolTiles, "handTiles = ", handTiles) if self.__dealer.initTiles(handTiles, poolTiles): ftlog.debug("self.tiles len2 = ", len(self.__tiles), "poolTiles = ", poolTiles, "handTiles = ", handTiles) self.__tiles = copy.deepcopy(self.__dealer.tiles) ftlog.debug("self.tiles len3 = ", len(self.__tiles), "poolTiles = ", poolTiles, "handTiles = ", handTiles) else: ftlog.debug("self.tiles len4 = ", len(self.__tiles)) self.__tiles = self.__dealer.shuffle(goodPointCount, handTileCount) ftlog.debug("self.tiles len5 = ", len(self.__tiles)) ftlog.info('MTableTile.shuffle tiles:', self.__tiles) if self.removeFeng: self.__tiles = filter(lambda x: not MTile.isFeng(x), self.__tiles) if self.removeArrow: self.__tiles = filter(lambda x: not MTile.isArrow(x), self.__tiles) if self.isRemoveWanTile: self.__tiles = filter( lambda x: MTile.getColor(x) == MTile.TILE_WAN, self.__tiles) return self.__tiles
def shuffle(self, goodPointCount, handTileCount): """ 洗牌器 子类里可添加特殊逻辑,比如确定宝牌 """ if self.tileTestMgr.initTiles(): # 检查手牌 handTiles = self.tileTestMgr.handTiles poolTiles = self.tileTestMgr.tiles ftlog.debug("self.tiles len1 = ", len(self.__tiles), "poolTiles = ", poolTiles, "handTiles = ", handTiles) if self.__dealer.initTiles(handTiles, poolTiles): ftlog.debug("self.tiles len2 = ", len(self.__tiles), "poolTiles = ", poolTiles, "handTiles = ", handTiles) self.__tiles = copy.deepcopy(self.__dealer.tiles) ftlog.debug("self.tiles len3 = ", len(self.__tiles), "poolTiles = ", poolTiles, "handTiles = ", handTiles) else: ftlog.debug("self.tiles len4 = ", len(self.__tiles)) self.__tiles = self.__dealer.shuffle(goodPointCount, handTileCount) ftlog.debug("self.tiles len5 = ", len(self.__tiles)) ftlog.info('MTableTile.shuffle tiles:', self.__tiles) if self.removeFeng: self.__tiles = filter(lambda x:not MTile.isFeng(x), self.__tiles) if self.removeArrow: self.__tiles = filter(lambda x:not MTile.isArrow(x), self.__tiles) return self.__tiles
def checkPengMao(cls,tile,maoDanSetting,maoTiles): ftlog.debug('MMao.checkChiMao tile:', tile, 'maoDanSetting: ', maoDanSetting,'maoTiles: ',maoTiles) if maoDanSetting & MTDefine.MAO_DAN_DNXBZFB: #乱锚情况下 if len(maoTiles) > 0:#已经放过锚 if MTile.isArrow(tile) or MTile.isFeng(tile):# return False else: if len(maoTiles) > 0:#已经放过锚 for mao in maoTiles: ftlog.debug('MMao.checkChiMao type:', mao['type']) if MTile.isArrow(tile) and mao['type'] == 1:#已放箭牌 return False if MTile.isFeng(tile) and mao['type'] == 2:#已放风牌 return False return True
def checkPengMao(cls,tile,maoDanSetting,maoTiles): ftlog.debug('MMao.checkChiMao tile:', tile, 'maoDanSetting: ', maoDanSetting,'maoTiles: ',maoTiles) if maoDanSetting & MTDefine.MAO_DAN_DNXBZFB: #乱锚情况下 if len(maoTiles) > 0:#已经放过锚 if MTile.isArrow(tile) or MTile.isFeng(tile):# return False else: if len(maoTiles) > 0:#已经放过锚 for mao in maoTiles: ftlog.debug('MMao.checkChiMao type:', mao['type']) if MTile.isArrow(tile) and mao['type'] == 1:#已放箭牌 return False if MTile.isFeng(tile) and mao['type'] == 2:#已放风牌 return False return True
def is13BuKaoWithOutLimit(cls, handTiles, hanMagics=[]): ''' 判断是否十三不靠 只要手牌没有靠着的就行 没有其他限制 hanMagics是手牌中的赖子数组,如手牌中有2个7是赖子 baoTiles=[7,7] ''' newHandTiles = copy.deepcopy(handTiles) # 有五张不同的风牌或箭牌 fengTiles = [] for index in range(0, len(newHandTiles)): if (MTile.isFeng(newHandTiles[index]) or MTile.isArrow(newHandTiles[index])): if (newHandTiles[index] not in fengTiles): fengTiles.append(newHandTiles[index]) else: return False, [] if len(fengTiles) > 0: for tile in fengTiles: newHandTiles.remove(tile) # 排序 newHandTiles.sort() for magic in hanMagics: if magic in newHandTiles: newHandTiles.remove(magic) # 根据花色分组 groups = [[] for _ in xrange(3)] for tile in newHandTiles: if ((tile % 10) == 0) or (tile >= 30): continue index = tile / 10 groups[index].append(tile) # 每组3张牌 buKaoCount = 0 for grp in groups: if len(grp) == 0: continue v = grp[0] % 10 if len(grp) == 2 and ((grp[1] % 10 == (v + 3) or grp[1] % 10 == (v + 6))): buKaoCount += len(grp) elif len(grp) == 3 and ((grp[1] % 10 == (v + 3) and grp[2] % 10 == (v + 6))): buKaoCount += len(grp) elif len(grp) == 1: buKaoCount += len(grp) ftlog.debug("buKaoCount ===", buKaoCount) ftlog.debug("handMagics ===", len(hanMagics)) ftlog.debug("fengTiles ===", len(fengTiles)) if buKaoCount + len(hanMagics) + len(fengTiles) != 14: return False, [] return True, [handTiles]
def is13BuKao(cls, handTiles): ''' 判断是否十三不靠 ''' #有五张不同的风牌或箭牌 fengTiles = [] for index in range(0, len(handTiles)): if (MTile.isFeng(handTiles[index]) or MTile.isArrow(handTiles[index])): if (handTiles[index] not in fengTiles): fengTiles.append(handTiles[index]) else: return False, [] if len(fengTiles) > 0: for tile in fengTiles: handTiles.remove(tile) #剩余9张牌 if not (len(fengTiles) == 5 and len(handTiles) == 9): return False, [] #排序 handTiles.sort() ftlog.debug("handTiles ===", handTiles) #根据花色分组 groups = [[] for _ in xrange(3)] for tile in handTiles: if ((tile % 10) == 0) or (tile >= 30): continue index = tile / 10 groups[index].append(tile) ftlog.debug("groups ===", groups) # 每组3张牌 types = [1, 2, 3] for grp in groups: if len(grp) != 3: return False, [] v = grp[0] % 10 if not (grp[1] % 10 == (v + 3) and grp[2] % 10 == (v + 6)): return False, [] if v in types: types.remove(v) else: return False, [] ftlog.debug("handTile ===", handTiles) handTiles.extend(fengTiles) return True, [handTiles]
def isLuanFengyise(cls, tiles, colorCount): """ 风一色 """ ftlog.debug('MWin.isLuanFengyise tiles:', tiles, ' colorCount:', colorCount) if colorCount > 1: return False, [] for tile in tiles: if (not MTile.isFeng(tile)) and (not MTile.isArrow(tile)): return False, [] ftlog.debug('MWin.isLuanFengyise ok, pattern:', tiles) return True, [tiles]
def hasMao(cls, tiles, maoDanSetting, alreadyHave = 0): ftlog.debug('MMao.hasMao tiles:', tiles , ' maoDanSetting:', maoDanSetting , ' alreadyHave:', alreadyHave) maos = [] if (maoDanSetting & MTDefine.MAO_DAN_DNXBZFB) and (not (alreadyHave & MTDefine.MAO_DAN_DNXBZFB)): pattern = [] values = [] for tile in tiles: if MTile.isFeng(tile) or MTile.isArrow(tile): pattern.append(tile) if tile not in values: values.append(tile) if len(values) >= 3: luanMao = {} luanMao['type'] = MTDefine.MAO_DAN_DNXBZFB luanMao['pattern'] = values luanMao['name'] = MTDefine.MAO_DAN_DNXBZFB_NAME maos.append(luanMao) if (maoDanSetting & MTDefine.MAO_DAN_DNXB) and \ (not (alreadyHave & MTDefine.MAO_DAN_DNXB) and \ (not (maoDanSetting & MTDefine.MAO_DAN_DNXBZFB))): pattern = [] values = [] for tile in tiles: if MTile.isFeng(tile): pattern.append(tile) if tile not in values: values.append(tile) if len(values) >= 3: fengMao = {} fengMao['type'] = MTDefine.MAO_DAN_DNXB fengMao['pattern'] = values fengMao['name'] = MTDefine.MAO_DAN_DNXB_NAME maos.append(fengMao) if (maoDanSetting & MTDefine.MAO_DAN_ZFB) and \ (not (alreadyHave & MTDefine.MAO_DAN_ZFB)) and \ (not (maoDanSetting & MTDefine.MAO_DAN_DNXBZFB)): pattern = [] values = [] for tile in tiles: if MTile.isArrow(tile): pattern.append(tile) if tile not in values: values.append(tile) if len(values) >= 3: arrowMao = {} arrowMao['type'] = MTDefine.MAO_DAN_ZFB arrowMao['pattern'] = values arrowMao['name'] = MTDefine.MAO_DAN_ZFB_NAME maos.append(arrowMao) if (maoDanSetting & MTDefine.MAO_DAN_YAO) and (not (alreadyHave & MTDefine.MAO_DAN_YAO)): pattern = [] values = [] for tile in tiles: if MTile.getValue(tile) == 1: pattern.append(tile) if tile not in values: values.append(tile) if len(values) >= 3: yaoMao = {} yaoMao['type'] = MTDefine.MAO_DAN_YAO yaoMao['pattern'] = values yaoMao['name'] = MTDefine.MAO_DAN_YAO_NAME maos.append(yaoMao) if (maoDanSetting & MTDefine.MAO_DAN_JIU) and (not (alreadyHave & MTDefine.MAO_DAN_JIU)): pattern = [] values = [] for tile in tiles: if MTile.getValue(tile) == 9: pattern.append(tile) if tile not in values: values.append(tile) if len(values) >= 3: jiuMao = {} jiuMao['type'] = MTDefine.MAO_DAN_JIU jiuMao['pattern'] = values jiuMao['name'] = MTDefine.MAO_DAN_JIU_NAME maos.append(jiuMao) ftlog.debug('MMao.hasMao tiles:', tiles , ' maoDanSetting:', maoDanSetting , ' maos:', maos) return maos
def checkMao(cls, pattern, maoType, maoDanSetting): ftlog.debug('MMao.checkMao pattern:', pattern , ' maoType:', maoType , ' maoDanSetting:', maoDanSetting) values = [] if maoType & MTDefine.MAO_DAN_DNXBZFB: #乱锚 if not maoDanSetting & MTDefine.MAO_DAN_DNXBZFB: return False for tile in pattern: if MTile.isArrow(tile) or MTile.isFeng(tile): values.append(tile) #取消对相同牌的检查 else: return False elif maoType & MTDefine.MAO_DAN_DNXB: if not maoDanSetting & MTDefine.MAO_DAN_DNXB: return False for tile in pattern: if MTile.isFeng(tile): if tile not in values: values.append(tile) continue else: return False elif maoType & MTDefine.MAO_DAN_ZFB: if not maoDanSetting & MTDefine.MAO_DAN_ZFB: return False for tile in pattern: if MTile.isArrow(tile): if tile not in values: values.append(tile) continue else: return False elif maoType & MTDefine.MAO_DAN_YAO: if not maoDanSetting & MTDefine.MAO_DAN_YAO: return False for tile in pattern: if MTile.getValue(tile) == 1: if tile not in values: values.append(tile) continue else: return False elif maoType & MTDefine.MAO_DAN_JIU: if not maoDanSetting & MTDefine.MAO_DAN_JIU: return False for tile in pattern: if MTile.getValue(tile) == 9: if tile not in values: values.append(tile) continue else: return False ftlog.debug('MMao.checkMao pattern:', pattern , ' maoType:', maoType) return len(values) >= 3
def hasExtendMao(cls, tiles, alreadyHave = 0): extendMaos = [] if alreadyHave & MTDefine.MAO_DAN_DNXBZFB: es = [] for tile in tiles: if MTile.isFeng(tile) or MTile.isArrow(tile): es.append(tile) if len(es) > 0: faNode = {} faNode['type'] = MTDefine.MAO_DAN_DNXBZFB faNode['extends'] = es faNode['name'] = MTDefine.MAO_DAN_DNXBZFB_NAME extendMaos.append(faNode) if alreadyHave & MTDefine.MAO_DAN_DNXB: es = [] for tile in tiles: if MTile.isFeng(tile): es.append(tile) if len(es) > 0: faNode = {} faNode['type'] = MTDefine.MAO_DAN_DNXB faNode['extends'] = es faNode['name'] = MTDefine.MAO_DAN_DNXB_NAME extendMaos.append(faNode) if alreadyHave & MTDefine.MAO_DAN_ZFB: es = [] for tile in tiles: if MTile.isArrow(tile): es.append(tile) if len(es) > 0: faNode = {} faNode['type'] = MTDefine.MAO_DAN_ZFB faNode['extends'] = es faNode['name'] = MTDefine.MAO_DAN_ZFB_NAME extendMaos.append(faNode) if alreadyHave & MTDefine.MAO_DAN_YAO: es = [] for tile in tiles: if MTile.getValue(tile) == 1: es.append(tile) if len(es) > 0: faNode = {} faNode['type'] = MTDefine.MAO_DAN_YAO faNode['extends'] = es faNode['name'] = MTDefine.MAO_DAN_YAO_NAME extendMaos.append(faNode) if alreadyHave & MTDefine.MAO_DAN_JIU: es = [] for tile in tiles: if MTile.getValue(tile) == 9: es.append(tile) if len(es) > 0: faNode = {} faNode['type'] = MTDefine.MAO_DAN_JIU faNode['extends'] = es faNode['name'] = MTDefine.MAO_DAN_JIU_NAME extendMaos.append(faNode) return extendMaos
def is13BuKaoWithOutLimit(cls, handTiles, handMagics=[], replaceMagics=[]): ''' 判断是否十三不靠 只要手牌没有靠着的就行 没有其他限制 hanMagics是手牌中的赖子数组,如手牌中有2个7是赖子 baoTiles=[7,7] replaceMagic是手牌中的顶赖子数组 如2万是赖子,白板是顶赖子牌,白板可以当作2万,但白板的2万不是赖子 ''' if len(replaceMagics) > 2 and len( handMagics) > 0 and handMagics[0] != replaceMagics[0]: return False, [] newHandTiles = copy.deepcopy(handTiles) # 排序 newHandTiles.sort() for magic in handMagics: if magic in newHandTiles: newHandTiles.remove(magic) if len(replaceMagics) == 2 and len( handMagics) > 0 and handMagics[0] != replaceMagics[0]: newHandTiles.append(handMagics[0]) newHandTiles.remove(replaceMagics[0]) # 有五张不同的风牌或箭牌 fengTiles = [] for index in range(0, len(newHandTiles)): if (MTile.isFeng(newHandTiles[index]) or MTile.isArrow(newHandTiles[index])): if (newHandTiles[index] not in fengTiles): fengTiles.append(newHandTiles[index]) else: return False, [] if len(fengTiles) > 0: for tile in fengTiles: newHandTiles.remove(tile) # 根据花色分组 groups = [[] for _ in xrange(3)] for tile in newHandTiles: if ((tile % 10) == 0) or (tile >= 30): continue index = tile / 10 groups[index].append(tile) # 每组3张牌 buKaoCount = 0 for grp in groups: if len(grp) == 0: continue v = grp[0] ftlog.debug("grp ===", grp) if len(grp) == 2 and (v + 2) < grp[1]: buKaoCount += len(grp) elif len(grp) == 3 and ((v + 2) < grp[1] and (grp[1] + 2) < grp[2]): buKaoCount += len(grp) elif len(grp) == 1: buKaoCount += len(grp) ftlog.debug("buKaoCount ===", buKaoCount) ftlog.debug("handMagics ===", len(handMagics)) ftlog.debug("fengTiles ===", len(fengTiles)) if buKaoCount + len(handMagics) + len(fengTiles) != 14: return False, [] return True, [handTiles]
def hasMao(self, tiles, maoDanSetting, alreadyHave=0, isFirstAddtile=False, extendInfo={}): hasPengMao = extendInfo.get('maoType', 0) #tiles手牌 #alreadyHave 已经有锚牌的类型: 0 没有 1 箭牌 2 风牌 #isFirstAddtile 还没出过牌 maos = [] if (maoDanSetting & MTDefine.MAO_DAN_DNXBZFB) and (not (alreadyHave & MTDefine.MAO_DAN_DNXBZFB)) and \ (not (hasPengMao )) and isFirstAddtile: pattern = [] values = [] for tile in tiles: if MTile.isFeng(tile) or MTile.isArrow(tile): pattern.append(tile) # if tile not in values: 乱锚取消相同牌检查 values.append(tile) if len(values) >= 3: luanMao = {} luanMao['type'] = MTDefine.MAO_DAN_DNXBZFB luanMao['pattern'] = values luanMao['name'] = MTDefine.MAO_DAN_DNXBZFB_NAME maos.append(luanMao) if (maoDanSetting & MTDefine.MAO_DAN_DNXB) and \ (not (alreadyHave & MTDefine.MAO_DAN_DNXB) and \ (not (maoDanSetting & MTDefine.MAO_DAN_DNXBZFB)) and \ (not (hasPengMao & MTDefine.MAO_DAN_DNXB )) and isFirstAddtile): pattern = [] values = [] for tile in tiles: if MTile.isFeng(tile): pattern.append(tile) if tile not in values: values.append(tile) if len(values) >= 3: fengMao = {} fengMao['type'] = MTDefine.MAO_DAN_DNXB fengMao['pattern'] = values fengMao['name'] = MTDefine.MAO_DAN_DNXB_NAME maos.append(fengMao) if (maoDanSetting & MTDefine.MAO_DAN_ZFB) and \ (not (alreadyHave & MTDefine.MAO_DAN_ZFB)) and \ (not (maoDanSetting & MTDefine.MAO_DAN_DNXBZFB)) and \ (not (hasPengMao & MTDefine.MAO_DAN_ZFB)) and isFirstAddtile: pattern = [] values = [] for tile in tiles: if MTile.isArrow(tile): pattern.append(tile) if tile not in values: values.append(tile) if len(values) >= 3: arrowMao = {} arrowMao['type'] = MTDefine.MAO_DAN_ZFB arrowMao['pattern'] = values arrowMao['name'] = MTDefine.MAO_DAN_ZFB_NAME maos.append(arrowMao) ftlog.debug('MMao.hasMao tiles:', tiles, ' maoDanSetting:', maoDanSetting, ' maos:', maos, 'alreadyHave:', alreadyHave, 'isFirstAddtile:', isFirstAddtile) return maos
def hasMao(cls, tiles, maoDanSetting, alreadyHave = 0): ftlog.debug('MMao.hasMao tiles:', tiles , ' maoDanSetting:', maoDanSetting , ' alreadyHave:', alreadyHave) maos = [] if (maoDanSetting & MTDefine.MAO_DAN_DNXBZFB) and (not (alreadyHave & MTDefine.MAO_DAN_DNXBZFB)): pattern = [] values = [] for tile in tiles: if MTile.isFeng(tile) or MTile.isArrow(tile): pattern.append(tile) if tile not in values: values.append(tile) if len(values) >= 3: luanMao = {} luanMao['type'] = MTDefine.MAO_DAN_DNXBZFB luanMao['pattern'] = values luanMao['name'] = MTDefine.MAO_DAN_DNXBZFB_NAME maos.append(luanMao) if (maoDanSetting & MTDefine.MAO_DAN_DNXB) and \ (not (alreadyHave & MTDefine.MAO_DAN_DNXB) and \ (not (maoDanSetting & MTDefine.MAO_DAN_DNXBZFB))): pattern = [] values = [] for tile in tiles: if MTile.isFeng(tile): pattern.append(tile) if tile not in values: values.append(tile) if len(values) >= 3: fengMao = {} fengMao['type'] = MTDefine.MAO_DAN_DNXB fengMao['pattern'] = values fengMao['name'] = MTDefine.MAO_DAN_DNXB_NAME maos.append(fengMao) if (maoDanSetting & MTDefine.MAO_DAN_ZFB) and \ (not (alreadyHave & MTDefine.MAO_DAN_ZFB)) and \ (not (maoDanSetting & MTDefine.MAO_DAN_DNXBZFB)): pattern = [] values = [] for tile in tiles: if MTile.isArrow(tile): pattern.append(tile) if tile not in values: values.append(tile) if len(values) >= 3: arrowMao = {} arrowMao['type'] = MTDefine.MAO_DAN_ZFB arrowMao['pattern'] = values arrowMao['name'] = MTDefine.MAO_DAN_ZFB_NAME maos.append(arrowMao) if (maoDanSetting & MTDefine.MAO_DAN_YAO) and (not (alreadyHave & MTDefine.MAO_DAN_YAO)): pattern = [] values = [] for tile in tiles: if MTile.getValue(tile) == 1: pattern.append(tile) if tile not in values: values.append(tile) if len(values) >= 3: yaoMao = {} yaoMao['type'] = MTDefine.MAO_DAN_YAO yaoMao['pattern'] = values yaoMao['name'] = MTDefine.MAO_DAN_YAO_NAME maos.append(yaoMao) if (maoDanSetting & MTDefine.MAO_DAN_JIU) and (not (alreadyHave & MTDefine.MAO_DAN_JIU)): pattern = [] values = [] for tile in tiles: if MTile.getValue(tile) == 9: pattern.append(tile) if tile not in values: values.append(tile) if len(values) >= 3: jiuMao = {} jiuMao['type'] = MTDefine.MAO_DAN_JIU jiuMao['pattern'] = values jiuMao['name'] = MTDefine.MAO_DAN_JIU_NAME maos.append(jiuMao) ftlog.debug('MMao.hasMao tiles:', tiles , ' maoDanSetting:', maoDanSetting , ' maos:', maos) return maos
def checkMao(cls, pattern, maoType, maoDanSetting): ftlog.debug('MMao.checkMao pattern:', pattern , ' maoType:', maoType , ' maoDanSetting:', maoDanSetting) values = [] if maoType & MTDefine.MAO_DAN_DNXBZFB: #乱锚 if not maoDanSetting & MTDefine.MAO_DAN_DNXBZFB: return False for tile in pattern: if MTile.isArrow(tile) or MTile.isFeng(tile): values.append(tile) #取消对相同牌的检查 else: return False elif maoType & MTDefine.MAO_DAN_DNXB: if not maoDanSetting & MTDefine.MAO_DAN_DNXB: return False for tile in pattern: if MTile.isFeng(tile): if tile not in values: values.append(tile) continue else: return False elif maoType & MTDefine.MAO_DAN_ZFB: if not maoDanSetting & MTDefine.MAO_DAN_ZFB: return False for tile in pattern: if MTile.isArrow(tile): if tile not in values: values.append(tile) continue else: return False elif maoType & MTDefine.MAO_DAN_YAO: if not maoDanSetting & MTDefine.MAO_DAN_YAO: return False for tile in pattern: if MTile.getValue(tile) == 1: if tile not in values: values.append(tile) continue else: return False elif maoType & MTDefine.MAO_DAN_JIU: if not maoDanSetting & MTDefine.MAO_DAN_JIU: return False for tile in pattern: if MTile.getValue(tile) == 9: if tile not in values: values.append(tile) continue else: return False ftlog.debug('MMao.checkMao pattern:', pattern , ' maoType:', maoType) return len(values) >= 3
def hasExtendMao(cls, tiles, alreadyHave = 0): extendMaos = [] if alreadyHave & MTDefine.MAO_DAN_DNXBZFB: es = [] for tile in tiles: if MTile.isFeng(tile) or MTile.isArrow(tile): es.append(tile) if len(es) > 0: faNode = {} faNode['type'] = MTDefine.MAO_DAN_DNXBZFB faNode['extends'] = es faNode['name'] = MTDefine.MAO_DAN_DNXBZFB_NAME extendMaos.append(faNode) if alreadyHave & MTDefine.MAO_DAN_DNXB: es = [] for tile in tiles: if MTile.isFeng(tile): es.append(tile) if len(es) > 0: faNode = {} faNode['type'] = MTDefine.MAO_DAN_DNXB faNode['extends'] = es faNode['name'] = MTDefine.MAO_DAN_DNXB_NAME extendMaos.append(faNode) if alreadyHave & MTDefine.MAO_DAN_ZFB: es = [] for tile in tiles: if MTile.isArrow(tile): es.append(tile) if len(es) > 0: faNode = {} faNode['type'] = MTDefine.MAO_DAN_ZFB faNode['extends'] = es faNode['name'] = MTDefine.MAO_DAN_ZFB_NAME extendMaos.append(faNode) if alreadyHave & MTDefine.MAO_DAN_YAO: es = [] for tile in tiles: if MTile.getValue(tile) == 1: es.append(tile) if len(es) > 0: faNode = {} faNode['type'] = MTDefine.MAO_DAN_YAO faNode['extends'] = es faNode['name'] = MTDefine.MAO_DAN_YAO_NAME extendMaos.append(faNode) if alreadyHave & MTDefine.MAO_DAN_JIU: es = [] for tile in tiles: if MTile.getValue(tile) == 9: es.append(tile) if len(es) > 0: faNode = {} faNode['type'] = MTDefine.MAO_DAN_JIU faNode['extends'] = es faNode['name'] = MTDefine.MAO_DAN_JIU_NAME extendMaos.append(faNode) return extendMaos