txlyre 10 시간 전
부모
커밋
bef89d1a90
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      chess0.py

+ 4 - 0
chess0.py

@@ -28,6 +28,10 @@ class ChessSession:
     def check_game_over(self):
         if self.board.is_game_over():
             raise GameOver(f"{outcome_to_str(self.board.outcome())} [{len(self.board.move_stack)}]")
+        elif self.board.status() & chess.STATUS_NO_WHITE_KING:
+            raise GameOver(f"0-1 CHECKMATE [{len(self.board.move_stack)}]")
+        elif self.board.status() & chess.STATUS_NO_BLACK_KING:
+            raise GameOver(f"1-0 CHECKMATE [{len(self.board.move_stack)}]")
         elif not self.board.is_valid():
             raise GameOver(f"Некорректное состояние доски.")