|
@@ -27,7 +27,7 @@ class ChessSession:
|
|
|
|
|
|
def check_game_over(self):
|
|
|
if self.board.is_game_over():
|
|
|
- raise GameOver(outcome_to_str(self.board.outcome()))
|
|
|
+ raise GameOver(f"{outcome_to_str(self.board.outcome())} {len(self.board.move_stack)}")
|
|
|
|
|
|
async def move(self, move=None):
|
|
|
if move is not None:
|
|
@@ -139,6 +139,13 @@ class ChessManager:
|
|
|
|
|
|
return bool(session.board.move_stack)
|
|
|
|
|
|
+ def moves_count(self, id):
|
|
|
+ session = self.sessions.get(id)
|
|
|
+ if not session:
|
|
|
+ raise KeyError(id)
|
|
|
+
|
|
|
+ return len(session.board.move_stack)
|
|
|
+
|
|
|
def moves(self, id, offset=None):
|
|
|
session = self.sessions.get(id)
|
|
|
if not session:
|