|
@@ -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)
|