diff --git a/api_functions.py b/api_functions.py index 285d3ff..ac0411f 100644 --- a/api_functions.py +++ b/api_functions.py @@ -1,3 +1,6 @@ +from random import shuffle + + def isEnd(cur, trueChatID): # cur.execute(f"SELECT ChatID FROM Chats WHERE TrueChatID = '{trueChatID}'") # row = cur.fetchall() @@ -24,3 +27,14 @@ def isEnd(cur, trueChatID): return "mafia" return "" + + +def role_cnt(user_count): + ls = [0, 0, 1, 1, 0] + ls[4] = user_count//4 + ls[1] = user_count - ls[4] + return ls + + +def role_distribution(userIDs, count_r): + pass diff --git a/app.py b/app.py index c5abe65..97087c2 100644 --- a/app.py +++ b/app.py @@ -48,7 +48,7 @@ def create(): db.close(cursor) -@app.route('/start_game', methods = ["POST"]) +@app.route('/start_game', methods=["POST"]) def start(): # Команда принимает на вход TCI = request.json['chatID'] userlist = request.json['usderIDs'] @@ -57,5 +57,6 @@ def start(): # Команда принимает на вход db.query_ins_user(id, curs) db.close() + if __name__ == '__main__': app.run() diff --git a/db.py b/db.py index 43d3b4f..72cf6d7 100644 --- a/db.py +++ b/db.py @@ -51,4 +51,3 @@ def query_change(x): def close(cur): cursor.close() -