def hasGang(self, tiles, curTile, state, extendInfo={}): """判断杠牌""" # 血战麻将必有定缺,如果定缺为-1,表明为初始化,则不判断是否有杠 absenceColor = extendInfo.get('absenceColor', -1) seatId = extendInfo.get('seatId', -1) if absenceColor == -1: ftlog.debug('MGangRuleSiChuan.hasGang: absenceColor:', absenceColor, 'tiles:', tiles, 'curTile:', curTile, 'seatId:', seatId) return [] tilesForGang = copy.deepcopy(tiles) tilesForGang[MHand.TYPE_HAND] = MTile.filterTilesWithOutColor( tilesForGang[MHand.TYPE_HAND], absenceColor) ftlog.debug('MGangRuleSiChuan.hasGang tileForGang:', tilesForGang) return super(MGangRuleSiChuan, self).hasGang(tilesForGang, curTile, state, extendInfo)
def hasPeng(self, tiles, tile, extendInfo={}): """是否有碰牌解 参数说明; tiles - 玩家的所有牌,包括手牌,吃牌,碰牌,杠牌,胡牌 tile - 待碰的牌 """ absenceColor = extendInfo.get('absenceColor', -1) if MTile.getColor(tile) == absenceColor: return [] tilesForPeng = copy.deepcopy(tiles[MHand.TYPE_HAND]) tilesForPeng = MTile.filterTilesWithOutColor(tilesForPeng, absenceColor) pengSolutions = [] if MPeng.hasPeng(tilesForPeng, tile): pengSolutions.append([tile, tile, tile]) return pengSolutions