Closed Ezraay closed 1 year ago
Does this copy() function okay ? def copy(self): """Create a deep copy of the current board.""" new_board = Board() new_board.heights = self.heights.copy() new_board.board = [row.copy() for row in self.board] new_board.size = self.size new_board.history = self.history.copy() return new_board
@Q-g2 code encounters an error you should make the function a part of the board object, see my initial code snippet for expected usage. Error is you can't access private members of a class outside code in the class declaration.
There needs to be ability to copy a board object into a new instance. It should be a smart copy that contains the same history, board state etc. This is required so that agents don't accidentally mess with the actual board state when performing searches incorrectly.