Inkcap commited on
Commit
6ff217d
·
1 Parent(s): cb8fc87

Preparing for merge with main

Browse files
Files changed (2) hide show
  1. src/game_database.py +2 -2
  2. src/logger.py +4 -6
src/game_database.py CHANGED
@@ -4,7 +4,7 @@ class game_database:
4
  def __init__(self):
5
  pass
6
 
7
- def display_game(self):
8
  pass
9
- def display_tournament(self):
10
  pass
 
4
  def __init__(self):
5
  pass
6
 
7
+ def display_game(self, game_num: int): #Displays analytics for a specific game
8
  pass
9
+ def display_tournament(self): #Displays analytics for the entire tournament
10
  pass
src/logger.py CHANGED
@@ -19,8 +19,8 @@ class logger:
19
  self.cheat_attempts[-1] += 1
20
 
21
  def add_checkmate(self, winner_name: str):
22
- #logs the winner and stops recording
23
- pass
24
 
25
  #Internal Work
26
  def get_stockfish_results(self, prev_state: str, current_state: str, depth: int = 5) -> float: #Takes current and previous FEN states. Can be refactored to only need one UCI current state
@@ -40,7 +40,7 @@ class logger:
40
 
41
  current_score = float(re.findall(r"-?\d*\.*\d+", current_string)[0]) #Positive means white is winning and vice versa
42
  prev_score = float(re.findall(r"-?\d*\.*\d+", prev_string)[0])
43
-
44
 
45
  return abs(current_score) - abs(prev_score) #Positive numbers mean the player that made the move is better off
46
  def format_game(self):
@@ -48,8 +48,7 @@ class logger:
48
 
49
  #Interface with game_database
50
  def return_formatted_game(self):
51
- pass
52
- """
53
  if self.winner == "":
54
  raise RuntimeError("Game is not yet completed")
55
  pass
@@ -57,7 +56,6 @@ class logger:
57
  else:
58
  game = {"UCI": self.current_moves, "Cheat Attempts": self.cheat_attempts}
59
  return game
60
- """
61
 
62
  #Testing section
63
  if __name__ == "__main__":
 
19
  self.cheat_attempts[-1] += 1
20
 
21
  def add_checkmate(self, winner_name: str):
22
+ self.winner = winner_name
23
+
24
 
25
  #Internal Work
26
  def get_stockfish_results(self, prev_state: str, current_state: str, depth: int = 5) -> float: #Takes current and previous FEN states. Can be refactored to only need one UCI current state
 
40
 
41
  current_score = float(re.findall(r"-?\d*\.*\d+", current_string)[0]) #Positive means white is winning and vice versa
42
  prev_score = float(re.findall(r"-?\d*\.*\d+", prev_string)[0])
43
+ #Add something to make sure it's that player's turn to make the move?
44
 
45
  return abs(current_score) - abs(prev_score) #Positive numbers mean the player that made the move is better off
46
  def format_game(self):
 
48
 
49
  #Interface with game_database
50
  def return_formatted_game(self):
51
+
 
52
  if self.winner == "":
53
  raise RuntimeError("Game is not yet completed")
54
  pass
 
56
  else:
57
  game = {"UCI": self.current_moves, "Cheat Attempts": self.cheat_attempts}
58
  return game
 
59
 
60
  #Testing section
61
  if __name__ == "__main__":