def is_tanyao(groups): """ Returns True if the hand satisfies tanyao. """ tiles = flatten_groups(groups) return all([isinstance(tile, NumberedTile) and tile.number in range(2, 9) for tile in tiles])
def is_chinitsu(groups): tiles = flatten_groups(groups) return any([all([isinstance(tile, numbered_tile) for tile in tiles]) for numbered_tile in NUMBERED_TILE_TYPES])