I am trying to do some math to values inside a 2D array. What I ultimately want to do is take the average of a "block" of the array, calculate average, and output to one of the registers within the array; this will be used to approximate voltage distribution within a grid.
The problem I am having is that my voltage [y][x] does not seem to register when doing any calculations. If I replace the y,x with specific numbers (coordinates within array) then the operations work fine for that location. See output below. I tried replacing voltage [y][x] = average with voltage [y][x] ++ for testing, and it seems to perform the action once only. It will increment all voltage [y][x] values by 1, but will not perform this action again on the next cycle.
The post/pre increment/decrement (++x,--y,etc) also modify x and y, you should consider switching to x/y +/-1 just to make it less confusing.
Also, what's the point of running 10 cycles if voltage[y][x] = 5.0 *( (x>=8) && (x<=12) && (y>=4) && (y<=6) ); resets them to the same values everytime?