0

I'm having some trouble keeping this array in bounds. I have a 10x10 array that I print out on screen. I call a function that changes the center value [5][5] and the values below/to the right/left of this center value. [j+1] [i-1][j+1], etc.. So the values constantly change and constantly move down towards the bottom of this 10x10 grid. I need to call the function many times to keep changing the values, however, once the values reach the very bottom of the grid they want to appear at the top and start moving down towards the middle. I need the values to stop at the bottom, the changes need to keep applying, but no wrapping from the top.

ie:


0  0  0  0  0
0  0  5  0  0
0  2  3  2  0
1  2  2  2  1

The function continues to get called and these values keep changing and progressing, but they never wrap. Whereas this is the problem I'm having:

0 2  2  3  0
1 1  1  2  1
0 0  0  0  0
0 0  5  0  0
1 2  3  3  2
1 1  1  1  1

I'm aware the number of cells is different, just getting the point across. Any help or tips would be greatly appreciated.

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by thekashyap
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.