Spaces:
Runtime error
Runtime error
Adding graphs for winner
Browse files- requirements.txt +3 -1
- src/game_database.py +11 -4
- src/logger.py +1 -1
requirements.txt
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
#To download requirements, use 'python -m pip install -r requirements.txt'
|
2 |
python-chess==1.10.0
|
3 |
matplotlib==3.8.2
|
4 |
-
requests==2.28.2
|
|
|
|
|
|
1 |
#To download requirements, use 'python -m pip install -r requirements.txt'
|
2 |
python-chess==1.10.0
|
3 |
matplotlib==3.8.2
|
4 |
+
requests==2.28.2
|
5 |
+
pandas==1.5.3
|
6 |
+
transformers==4.36.2
|
src/game_database.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import chess
|
2 |
-
import matplotlib.pyplot as
|
3 |
import pandas as pd
|
4 |
from typing import Dict
|
5 |
from logger import Logger
|
@@ -17,12 +17,14 @@ class GameDatabase:
|
|
17 |
def display_tournament(self): #Displays analytics for the entire tournament
|
18 |
|
19 |
df = pd.DataFrame(self.db)
|
20 |
-
print(df)
|
21 |
|
22 |
#heatmap of tournament winrates
|
23 |
|
24 |
-
#bar chart of tournament winrates
|
25 |
-
|
|
|
|
|
|
|
26 |
pass
|
27 |
|
28 |
if __name__ == "__main__":
|
@@ -37,8 +39,13 @@ if __name__ == "__main__":
|
|
37 |
test_logger_2.add_checkmate("BERT")
|
38 |
formatted_2 = test_logger_2.return_formatted_game()
|
39 |
|
|
|
|
|
|
|
|
|
40 |
db = GameDatabase()
|
41 |
db.add_game(formatted)
|
42 |
db.add_game(formatted_2)
|
|
|
43 |
|
44 |
db.display_tournament()
|
|
|
1 |
import chess
|
2 |
+
import matplotlib.pyplot as plt
|
3 |
import pandas as pd
|
4 |
from typing import Dict
|
5 |
from logger import Logger
|
|
|
17 |
def display_tournament(self): #Displays analytics for the entire tournament
|
18 |
|
19 |
df = pd.DataFrame(self.db)
|
|
|
20 |
|
21 |
#heatmap of tournament winrates
|
22 |
|
23 |
+
#bar chart of tournament winrates
|
24 |
+
win_results = df["Winner"].value_counts()
|
25 |
+
print(win_results.rank())
|
26 |
+
win_results.plot.bar()
|
27 |
+
plt.show()
|
28 |
pass
|
29 |
|
30 |
if __name__ == "__main__":
|
|
|
39 |
test_logger_2.add_checkmate("BERT")
|
40 |
formatted_2 = test_logger_2.return_formatted_game()
|
41 |
|
42 |
+
test_logger_3 = Logger("ChessGPT", "BERT")
|
43 |
+
test_logger_3.add_checkmate("ChessGPT")
|
44 |
+
formatted_3 = test_logger_3.return_formatted_game()
|
45 |
+
|
46 |
db = GameDatabase()
|
47 |
db.add_game(formatted)
|
48 |
db.add_game(formatted_2)
|
49 |
+
db.add_game(formatted_3)
|
50 |
|
51 |
db.display_tournament()
|
src/logger.py
CHANGED
@@ -2,7 +2,7 @@ import requests
|
|
2 |
import re
|
3 |
|
4 |
class Logger:
|
5 |
-
def __init__(self, model_1: str, model_2: str):
|
6 |
self.model_1 = model_1
|
7 |
self.model_2 = model_2
|
8 |
self.current_moves = ""
|
|
|
2 |
import re
|
3 |
|
4 |
class Logger:
|
5 |
+
def __init__(self, model_1: str, model_2: str): #Model 1 should be white
|
6 |
self.model_1 = model_1
|
7 |
self.model_2 = model_2
|
8 |
self.current_moves = ""
|