I have a multidimensional array called old_arr which is like this [[8,8,8,8,0,0,0,0,6,6,5,5],[...]] then I have an updated multidimensional array new_arr like this [[9,9,6,7,3,6,5,0,6,4,3,4],[...]] What I want to do is to update the new_arr so that if the value in it corresponds to a 0 in old_arr then the value should be 0 otherwise keep the new value. So in the above example the new_arr would look like this [[9,9,6,7,0,0,0,0,6,4,3,4],[...]] where the 3,6,5 where replaced by 0. Any advice?
Also I want to know if it is possible to update the cell to 0 only if 4 out of it's 8 surrounding neighbour cells have the value 0 as well? Like new_arr and old_arr are multidimensional array (lists) which represents rows and cols so they are like a big table as shown in the below image where the blue cell in the new_arr will only be updated to zero if the corresponding cell in the old_arr is 0 and 4 of its neighbour cells are 0 (white cells in the photo)
So I need to check all 8neighbour cells (sometimes 6 or 7 depending on the cell position where it's in the middle (8) or edges(7) or corners (6) ) if they are zeros or not and count them, if the count is 4 or more then set the cell value to 0.
So if old_arr is
[[8,8,8,8,0,0,0,0,6,6,5,5],
[8,8,8,8,0,x,0,0,6,6,5,5],
[8,8,8,8,0,0,0,0,6,6,5,5],
[8,8,8,8,0,0,0,0,6,6,5,5],....]
Where x is a zero
And new_arr is
[[9,9,6,7,3,6,5,0,6,4,3,4],
[9,9,6,7,3,6,5,0,6,4,3,4],
[9,9,6,7,3,6,5,0,6,4,3,4],
[9,9,6,7,3,6,5,0,6,4,3,4],....]
For the highlighted cell, the corresponding cell in the new_arr will be zero because the highlighted cell in old_arr is 0 and more than 4 of its neighbor cells are zeros as well.
Updated new_arr is
[[9,9,6,7,3,0,0,0,6,4,3,4],
[9,9,6,7,0,0,0,0,6,4,3,4],
[9,9,6,7,0,0,0,0,6,4,3,4],
[9,9,6,7,0,0,0,0,6,4,3,4],....]

[8,8,8,8,0,**0**,0,0,6,6,5,5], only3of the neighbouring cells are0? Unless I'm not looking at it right.