txlyre 20 hours ago
parent
commit
0493855a06
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 re.match(r"^[0-9]{1,3}$", moves):
+            try:
+                moves = int(moves)
+            except ValueError:
+                raise IllegalMove(moves)
+
+            if moves < 1 or moves > 959:
+                raise IllegalMove(moves)
+
+            self.board.set_chess960_pos(moves)
+
+            return
+
         if "/" in moves:
             try:
                 self.board.set_fen(moves)