|  | @@ -26,14 +26,8 @@ class ChessSession:
 | 
	
		
			
				|  |  |          move = move.strip()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          try:
 | 
	
		
			
				|  |  | -            if move.startswith(":"):
 | 
	
		
			
				|  |  | -                move = self.board.parse_san(move[1:])
 | 
	
		
			
				|  |  | -            else:
 | 
	
		
			
				|  |  | -                move = self.board.parse_uci(move)
 | 
	
		
			
				|  |  | -        except (chess.InvalidMoveError, chess.IllegalMoveError):
 | 
	
		
			
				|  |  | -            raise IllegalMove(move)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        if move != chess.Move.null() and move not in self.board.legal_moves:
 | 
	
		
			
				|  |  | +            move = self.board.parse_san(move)
 | 
	
		
			
				|  |  | +        except (chess.InvalidMoveError, chess.IllegalMoveError, chess.AmbiguousMoveError):
 | 
	
		
			
				|  |  |              raise IllegalMove(move)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return move
 | 
	
	
		
			
				|  | @@ -65,9 +59,23 @@ class ChessSession:
 | 
	
		
			
				|  |  |      def from_moves(self, moves, strict=True):
 | 
	
		
			
				|  |  |          self.board.reset()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        moves = moves.strip().split(" ")
 | 
	
		
			
				|  |  | -        if len(moves) > 600 or (strict and len(moves) % 2 != 0):
 | 
	
		
			
				|  |  | -            raise IllegalMove
 | 
	
		
			
				|  |  | +        moves = moves.strip()
 | 
	
		
			
				|  |  | +        if moves.startswith("1."):
 | 
	
		
			
				|  |  | +            text = moves
 | 
	
		
			
				|  |  | +            moves = []
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            while text and len(moves) < 600:
 | 
	
		
			
				|  |  | +                match = re.match(r"^(?:\d+\. ?([^.\s]+) ([^.\s]+))", text)
 | 
	
		
			
				|  |  | +                if not match:
 | 
	
		
			
				|  |  | +                    raise IllegalMove
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                moves.extend((match.group(1), match.group(2)))           
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                text = text[match.end() - match.start():].strip()
 | 
	
		
			
				|  |  | +        else:
 | 
	
		
			
				|  |  | +            moves = moves.split(" ")
 | 
	
		
			
				|  |  | +            if len(moves) > 600 or (strict and len(moves) % 2 != 0):
 | 
	
		
			
				|  |  | +                raise IllegalMove
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          for i, move in zip(range(len(moves)), moves):
 | 
	
		
			
				|  |  |              move = self.parse_move(move)
 |