txlyre 21 hours ago
parent
commit
bd11dd091f
1 changed files with 13 additions and 0 deletions
  1. 13 0
      chess0.py

+ 13 - 0
chess0.py

@@ -98,6 +98,19 @@ class ChessSession:
         self.board.reset()
 
         moves = moves.strip()
+        if "/" in moves:
+            try:
+                self.board.set_fen(moves)
+            except ValueError:
+                raise IllegalMove
+
+            if not self.board.is_valid():
+                raise IllegalMove
+
+            self.check_game_over()
+
+            return
+
         if moves.startswith("1."):
             text = moves
             moves = []