txlyre 20 hours ago
parent
commit
faf6396047
2 changed files with 1 additions and 25 deletions
  1. 1 22
      chess0.py
  2. 0 3
      commands.py

+ 1 - 22
chess0.py

@@ -14,24 +14,10 @@ class IllegalMove(Exception):
     pass
     pass
 
 
 
 
-class MyBoard(chess.Board):
-    def __init__(self, fen=chess.STARTING_FEN, chess960=False):
-        chess.Board.__init__(self, fen=fen, chess960=chess960)
-
-        self.captured_black = []
-        self.captured_white = []
-
-    def _push_capture(self, move, capture_square, piece_type, was_promoted):
-        if self.turn == chess.WHITE:
-            self.captured_black.append(piece_type)
-        else:
-            self.captured_white.append(piece_type)
-
-
 class ChessSession:
 class ChessSession:
     def __init__(self, engine):
     def __init__(self, engine):
         self.engine = engine
         self.engine = engine
-        self.board = MyBoard()
+        self.board = chess.Board()
 
 
         self.ts = time.time()
         self.ts = time.time()
         self.move_ts = time.time()
         self.move_ts = time.time()
@@ -218,10 +204,3 @@ class ChessManager:
             moves = session.board.move_stack
             moves = session.board.move_stack
 
 
         return " ".join(map(str, moves))
         return " ".join(map(str, moves))
-
-    def captured(self, id):
-        session = self.sessions.get(id)
-        if not session:
-            raise KeyError(id)
-
-        return (session.board.captured_black, session.board.captured_white)

+ 0 - 3
commands.py

@@ -667,9 +667,6 @@ def chess_game_stats(chess, id):
     if chess.is_check(id):
     if chess.is_check(id):
         text = f"Шах!\n{text}"
         text = f"Шах!\n{text}"
 
 
-    captured_b, captured_w = chess.captured(id)
-    text += f"\nЗахвачено белых фигур: {len(captured_w)}\nЗахвачено чёрных фигур: {len(captured_b)}"
-
     return text
     return text