Bot.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:tinder-telegram-bot 作者: arthurdk 项目源码 文件源码
def dynamic_timeout_formular(min_votes, votes_fraction):
    """
    Formula used for dynamic timeout
    :param min_votes:
    :param votes_fraction:
    :return:
    """
    if votes_fraction >= 1:
        return 1 / votes_fraction  # Reduce timeout if more people than necessary voted

    result = 1
    result += (1 - votes_fraction) * math.log2(min_votes)  # Linear part makes timeout rise
    result += min_votes * (
        min_votes ** ((1 - votes_fraction) ** 3) - 1)  # Exponential part to punish really low vote counts
    result += (40 - 40 ** (votes_fraction)) / min_votes ** 2  # Punish missing votes harder if min_votes is low
    return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号