关于dff[random.choice(get_neighbors((i, j)))] += 1元胞动机的程序
def update_DFF(dff, diff):#for cell in diff:
# assert walls[cell] > -10
# dff[cell] += 1
dff += diff
for i, j in it.chain(it.product(range(1, dim_x - 1), range(1, dim_y - 1)), exit_cells):
for _ in range(int(dff[i, j])):
if np.random.rand() < delta: # decay
dff[i, j] -= 1
elif np.random.rand() < alpha: # diffusion
dff[i, j] -= 1
dff[random.choice(get_neighbors((i, j)))] += 1
assert walls[i, j] > -10 or dff[i, j] == 0, (dff, i, j)
# dff[:] = np.ones((dim_x, dim_y))
这段程序不太懂,哪位大神帮帮忙,特别是 dff[random.choice(get_neighbors((i, j)))] += 1,assert walls[i, j] > -10 or dff[i, j] == 0, (dff, i, j)这两句,谢谢!