Ejemplo n.º 1
0
def next_turn(game):
    game_states = GameState.find({'game_id': game.id})

    if len(game_states) > 0:
        game_state = game_states[0]
        moves = get_moves(game_state, game.turn_time * 5)
        next_game_state = Engine.resolve_moves(game_state, moves)
        next_game_state.insert()

        return next_game_state
    else:
        raise Exception('No GameStates found for %s' % game)
Ejemplo n.º 2
0
def next_turn(game):
    game_states = GameState.find({'game_id': game.id}, limit=1)

    if len(game_states) > 0:
        game_state = game_states[0]
        moves = get_moves(game_state, game.turn_time * 5)
        next_game_state = Engine.resolve_moves(game_state, moves)
        next_game_state.insert()

        return next_game_state
    else:
        raise Exception('No GameStates found for %s' % game)
Ejemplo n.º 3
0
def next_turn(game):
    game_states = GameState.find({'game_id': game.id}, limit=1)
    if not game_states:
        raise Exception('No GameStates found for %s' % game)

    game_state = game_states[0]

    # Update taunts and moves
    _update_snakes(game_state.snakes, ai.move(game, game_state))

    next_game_state = Engine.resolve_moves(game_state)
    next_game_state.insert()

    return next_game_state