txlyre 22 hours ago
parent
commit
9df58c992c
1 changed files with 3 additions and 3 deletions
  1. 3 3
      chess0.py

+ 3 - 3
chess0.py

@@ -58,13 +58,13 @@ class ChessSession:
         if len(moves) > 2048 or len(moves) % 2 != 0:
             raise IllegalMove
 
-        for move in moves:
+        for i, move in zip(range(len(moves)), moves):
             try:
                 move = chess.Move.from_uci(move)
             except chess.InvalidMoveError:
                 raise IllegalMove(move)
-
-            if move not in self.board.legal_moves:
+ 
+            if move not in self.board.legal_moves and not (move == chess.Move.null() and i % 2 == 0):
                 raise IllegalMove(move)
 
             self.board.push(move)