|
@@ -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)
|
|
|