-
Notifications
You must be signed in to change notification settings - Fork 0
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
nitko12
committed
Apr 13, 2024
1 parent
71900f8
commit 5eb8191
Showing
13 changed files
with
261 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ server: | |
host: 0.0.0.0 | ||
|
||
redis: | ||
port: 6379 | ||
port: 6479 | ||
host: localhost | ||
|
||
admin: | ||
|
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,61 @@ | ||
from model.game import Game | ||
from model import Game, Team, Order, Player, DatasetData, Datasets | ||
from operator import attrgetter | ||
from pprint import pprint | ||
from typing import List | ||
from logger import logger | ||
from datetime import datetime, timedelta | ||
from config import config | ||
|
||
|
||
if __name__ == "__main__": | ||
logger.info("Creating games") | ||
datasets: List[Datasets] = Datasets.find().all() | ||
datasets.sort(key=attrgetter("dataset_name")) | ||
assert len(datasets) > 0 | ||
# pprint(datasets) | ||
# print("Creating First testing round") | ||
|
||
# for i, dataset in enumerate(datasets): | ||
# dataset_id = dataset.dataset_id | ||
# # print(dataset_id) | ||
# dataset_data = DatasetData.find(DatasetData.dataset_id == dataset_id).all() | ||
# print(i, dataset_id, len(dataset_data)) | ||
|
||
|
||
|
||
games = [ | ||
# Game( | ||
# game_name="First contest round", | ||
# is_contest=int(True), | ||
# dataset_id=datasets[6].dataset_id, | ||
# start_time=datetime.now() + timedelta(milliseconds=15*1000*60), | ||
# total_ticks=1800, | ||
# tick_time=1000 | ||
# ), | ||
Game( | ||
game_name="Fifth normal round", | ||
is_contest=int(False), | ||
dataset_id=datasets[13].dataset_id, | ||
start_time=datetime.now() + timedelta(milliseconds=5000), | ||
total_ticks=5000, | ||
tick_time=3000 | ||
), | ||
] | ||
for game in games: | ||
game.save() | ||
print(game.pk) | ||
|
||
# bots_team_name = config["bots"]["team_name"] | ||
# bots_team_secret = config["bots"]["team_secret"] | ||
# if Team.find( | ||
# Team.team_name == bots_team_name, | ||
# Team.team_secret == bots_team_secret, | ||
# ).count() > 0: | ||
# logger.info("Bots team already created") | ||
# else: | ||
# logger.info("Creating bots team") | ||
# Team( | ||
# team_name=bots_team_name, | ||
# team_secret=bots_team_secret, | ||
# ).save() |
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,91 @@ | ||
team_names = [ | ||
"); DROP TABLE players; --", | ||
"brokeRS", | ||
"Cekmi", | ||
"Data Diggers", | ||
"Guta", | ||
"INAI", | ||
"Kako mislis mene nema?", | ||
"Kodirani Kapital", | ||
"LIMA", | ||
"Maas", | ||
"Održavanje dalekovoda", | ||
"OptiMinds", | ||
"Pip install v2", | ||
"Šampioni Hackathona", | ||
"Three and a half men", | ||
"Between exams", | ||
"Evolutionary Enigmas", | ||
"green48", | ||
"Jerry & Totally Spies", | ||
"Pigeons", | ||
"Polacy Robacy", | ||
"si_intl", | ||
"UW2", | ||
"Vanjo", | ||
"Warsaw Mesh Trade AI", | ||
] | ||
|
||
leaderboard_scores = [200, 182, 170, 158, 146, 134, 124, 114, 104, 94, 84, 78, 72, 66, 60, 54, 48, 42, 36, 30, 24, 18, 12, 6, 0] | ||
|
||
|
||
lines = [] | ||
with open('scores/01HVAB7VVCN6DYYAYHM8142WGB_First contest round.txt', "r") as f: | ||
for line in f: | ||
lines.append(line) | ||
last_line = line | ||
|
||
# text = "1196, [(Polacy Robacy/Polacy_Robacy, 107251400), (Jerry & Totally Spies/Botko, 94323634), (Pip install v2/pom, 37574900), (Održavanje dalekovoda/, 136683600), (si_intl/dfg, 53925395), (Evolutionary Enigmas/ttt, 224211978), (Data Diggers/diggy, 220143262), (Kako mislis mene nema?/ElonMusk Kukulele, 167075037), (OptiMinds/OptiMindsPlayer, 62426452), (Kruno/Casey Jones, 163297233), (Maas/Maas, 39749469), (green48/test2, 100015214), (Cekmi/ivkalu_bot, 43196913), (brokeRS/brrsbot, 270338065), (Between exams/string, 322312528), (Kodirani Kapital/Kodirani Kapital, 1196722622), (Warsaw Mesh Trade AI/croatia_on_steroids, 310802358), (Three and a half men/test, 326151613), (UW2/mati, 320454914), (LIMA/LIMA_1, 56961157), (Šampioni Hackathona/testko3, 392445174)]" | ||
def parse_one(text): | ||
team_scores = [] | ||
for team_name in team_names: | ||
try: | ||
ind = text.index(team_name) | ||
except Exception: | ||
continue | ||
# try: | ||
ind_1 = text.index(", ", ind) | ||
try: | ||
ind_2 = text.index("), ", ind_1) | ||
except Exception: | ||
ind_2 = text.index(")]", ind_1) | ||
score = int(text[ind_1+2: ind_2]) | ||
team_scores.append((score, team_name)) | ||
# except Exception: | ||
# print(f"Error parsing score for team {team_name}") | ||
return team_scores | ||
|
||
def print_last(): | ||
team_scores = parse_one(last_line) | ||
team_scores.sort(reverse=True) | ||
for i, value in enumerate(team_scores): | ||
score, team_name = value | ||
print(f"{i+1}) {leaderboard_scores[i]} - {score}$ - {team_name}, {score/50_000_000}") | ||
|
||
|
||
def one_to_dict(team_scores): | ||
scores_dict = {} | ||
for score, team_name in team_scores: | ||
scores_dict[team_name] = score | ||
return scores_dict | ||
|
||
# all_scores_dict = {team_name: [] for team_name in team_names} | ||
|
||
# scores = [] | ||
# for line in lines: | ||
# tick_dict = one_to_dict(parse_one(line)) | ||
# for team_name in team_names: | ||
# try: | ||
# score = tick_dict[team_name] | ||
# except Exception: | ||
# score = 50_000_000 | ||
# all_scores_dict[team_name].append(score) | ||
|
||
|
||
# print(len(scores)) | ||
|
||
print_last() | ||
|
||
# print(last_line) | ||
|
||
# DataFrame |
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
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
Oops, something went wrong.