예제 #1
0
파일: start.py 프로젝트: plafrance/TP4
def main_game(game_id):
    global API
    API.clear()
    last_command_id = 0
    end = False
    data_user = API.user()
    while not end:
        pipes = API.pipes(game_id, last_command_id)
        last_command_id = pipes["last_id"]
        for command in pipes["commands"]:
            if command["type"] == "1" and command["user_id"] == data_user["id"] or command["type"] == "0":
                exec(command["command"])
        if not pipes["commands"]:
            time.sleep(1)