Exemplo n.º 1
0
	def load(I, path):
		"""
		Reset the board and load history from given path.
		"""
		with open(path, mode='r', encoding='utf-8') as f:
			history = json.load(f, object_hook=Turn.from_json)
		board = Board()
		for turn in history:
			for src, dst in turn.moves:
				board = board.move(src, dst)
		I.board = board
		I.history = history
Exemplo n.º 2
0
 def load(I, path):
     """
     Reset the board and load history from given path.
     """
     with open(path, mode='r', encoding='utf-8') as f:
         history = json.load(f, object_hook=Turn.from_json)
     board = Board()
     for turn in history:
         for src, dst in turn.moves:
             board = board.move(src, dst)
     I.board = board
     I.history = history