-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
127 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
N = 256 | ||
K = 16 | ||
K = 18 | ||
R = 0.002 | ||
B = 10 | ||
C = 100 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import requests | ||
import os | ||
from dotenv import load_dotenv | ||
|
||
# Load environment variables | ||
load_dotenv() | ||
|
||
API_KEY = os.getenv('SRC_API_TOKEN') | ||
API_BASE_URL = 'https://secondrobotics.org' | ||
|
||
def clear_leaderboard(game_mode): | ||
url = f"{API_BASE_URL}/api/ranked/clear-leaderboard/" | ||
headers = { | ||
'Content-Type': 'application/json', | ||
'X-API-KEY': API_KEY | ||
} | ||
payload = {"game_mode": game_mode} | ||
|
||
response = requests.post(url, json=payload, headers=headers) | ||
if response.status_code == 200: | ||
print("Leaderboard cleared successfully.") | ||
else: | ||
print(f"Error clearing leaderboard: Status code {response.status_code}") | ||
print(f"Response content: {response.text}") | ||
|
||
def recalculate_elo(game_mode): | ||
url = f"{API_BASE_URL}/api/ranked/recalculate-elo/" | ||
headers = { | ||
'Content-Type': 'application/json', | ||
'X-API-KEY': API_KEY | ||
} | ||
payload = {"game_mode": game_mode} | ||
|
||
response = requests.post(url, json=payload, headers=headers) | ||
if response.status_code == 200: | ||
print("ELO recalculated successfully.") | ||
else: | ||
print(f"Error recalculating ELO: Status code {response.status_code}") | ||
print(f"Response content: {response.text}") | ||
|
||
if __name__ == "__main__": | ||
game_mode = input("Enter the game mode to reset and recalculate ELO: ") | ||
|
||
confirmation = input(f"Are you sure you want to clear the leaderboard and recalculate ELO for game mode '{game_mode}'? (y/n): ").lower() | ||
|
||
if confirmation == 'y': | ||
clear_leaderboard(game_mode) | ||
recalculate_elo(game_mode) | ||
else: | ||
print("Operation cancelled.") |