consumers.py 文件源码

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

项目:Interactive_estimation 作者: adminq80 项目源码 文件源码
def game_state_checker(game, state, round_data, users_plots, counter=0):
    if counter == SECONDS:
        # move to the next state
        if state == 'initial':
            start_interactive(game, round_data, users_plots)
        elif state == 'interactive':
            start_outcome(game, round_data, users_plots)
        else:
            start_initial(game)
        return

    if state == 'initial':
        r = InteractiveRound.objects.filter(game=game, round_order=round_data.get('current_round'), guess=None).count()
        if r == 0:
            start_interactive(game, round_data, users_plots)
            return
    elif state == 'interactive':
        r = InteractiveRound.objects.filter(game=game, round_order=round_data.get('current_round'),
                                            influenced_guess=None).count()
        if r == 0:
            start_outcome(game, round_data, users_plots)
            return
    elif state == 'outcome':
        r = InteractiveRound.objects.filter(game=game, round_order=round_data.get('current_round'),
                                            outcome=False).count()
        if r == 0:
            start_initial(game)
            return
    counter += 1
    task.deferLater(reactor, 1, game_state_checker, game, state, round_data, users_plots, counter).addErrback(
        twisted_error)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号