I was wondering:
def get_empty_cell():
return {'p': [[], []], 'h': {}, 'b': []}
def create_new_board(old_board):
height = len(old_board) + 4
width = len(old_board[0]) + 4
self.board = [None] * height
for i in range(0, height):
self.board[i] = [None] * width
for j in range(0, width):
# (!) deepcopy()
self.board[i][j] = copy.deepcopy(self.get_empty_cell())
I'm using deepcopy because I've had many situations where different variables access the same content. But when Python returns "new" dictionaries like in my code, do I need to use copy.deepcopy
if I want different cells or is it like JavaScript?
(and off topic: I'm sure my code could be optimized "the Python way"...)