def can_concealed_kong(self, tiles, t): """ 能暗杠 """ if t in self.kingTiles: return False if t == const.DRAGON_GREEN: return False return utility.get_count(tiles, t) == 4
def can_exposed_kong(self, tiles, t, pIdx=None): """ 能明杠 """ # if not self.canOperationByTimesLimit(pIdx): # return False # if not self.canOperationByKingTile(pIdx): # return False return util.get_count(tiles, t) == 3
def cal_lucky_tile(self, win_tiles, lucky_tile): if lucky_tile == 1: # 一码全中 if len(self.tiles) > 0: final = self.tiles[0] self.tiles = self.tiles[1:] return [final], 10 if final == const.DRAGON_RED else final % 10 else: return [], 0 else: if util.get_count(win_tiles, const.DRAGON_RED) == 0: lucky_tile += 1 final = min(len(self.tiles), lucky_tile) see_tiles = [] count = 0 for i in range(final): t = self.tiles[0] self.tiles = self.tiles[1:] see_tiles.append(t) if t in self.lucky_set: count += 1 return see_tiles, count
def can_concealed_kong(self, tiles, t): """ 能暗杠 """ if t == self.kingTile: return False return util.get_count(tiles, t) == 4
def get_dragon_green_num(self, tiles): return utility.get_count(tiles, const.DRAGON_GREEN)
def check_is_dragon_green(self, tiles): num = utility.get_count(tiles, const.DRAGON_GREEN) if len(tiles) != num or len(tiles) <= 0: return False return True
def can_exposed_kong(self, tiles, t): """ 能明杠 """ if t in self.kingTiles: return False return utility.get_count(tiles, t) == 3
def can_concealed_kong(self, tiles, t): """ 能暗杠 """ return util.get_count(tiles, t) == 4