04: Copying of arrays is required

This commit is contained in:
2022-10-03 16:02:10 +02:00
parent d76f894591
commit 3988b33d80

View File

@ -916,7 +916,8 @@
"def remains_valid_after_move(x,i,next_position,L):\n", "def remains_valid_after_move(x,i,next_position,L):\n",
" '''Returns True if replacing x[i] by next_position would yield a valid configuration,\n", " '''Returns True if replacing x[i] by next_position would yield a valid configuration,\n",
" otherwise False.'''\n", " otherwise False.'''\n",
" # TODO: Do I need to operate on a copy?\n", " # We need to create a copy as not to alter the original x\n",
" # outside this function.\n",
" copy_x = np.copy(x)\n", " copy_x = np.copy(x)\n",
" copy_x[i] = next_position\n", " copy_x[i] = next_position\n",
" return disk_config_valid(copy_x, L)" " return disk_config_valid(copy_x, L)"