コード例 #1
0
def play_game(id_player, id_room, config):
    nb_actions = 0
    while True:
        status_room = get(BASE_URL + "/status_room/" + id_room)
        if status_room['status'] == 3:
            status_game = get(BASE_URL + "/status_game/" + id_room +
                              "?idPlayer=" + id_player)
            if status_game['turnPlayer'] == id_player:
                if nb_actions == 0:
                    nb_actions = status_game['maxNbActions']
                    print("Nb actions : %s" % (str(nb_actions)))
                do_action(id_player, id_room, status_game)
                nb_actions -= 1
                if nb_actions == 0:
                    end_turn(id_player, id_room)
        time.sleep(1)
コード例 #2
0
ファイル: play_game.py プロジェクト: LeoLeDiouron/battle-grid
def end_turn(id_player, id_room):
    print("end turn")
    get(BASE_URL + "/turn_over/" + id_room + "?idPlayer=" + id_player)
コード例 #3
0
def join_random_room(id_player):
    response = get(BASE_URL + "/random_room?idPlayer=" + id_player)
    return response['idRoom']
コード例 #4
0
def get_id_player():
    response = get(BASE_URL + "/id_player")
    return response['idPlayer']
コード例 #5
0
def load_config():
    response = get(BASE_URL + "/config")
    return response['config']