Hi!
I was wondering if anyone can tell me a statement to iterate through a 2d array of objects called "animalsAndGrass".
While it is iterating through it I want to be able to output the open locations i.e. the locations in the 2d array not holding any objects.
For example i know i can iterate through the array like so..
for (int i = 0; i < ROWS; i++) { for (int j = 0; j < COLS; j++) { } }
Would I be better to output and store the open locations to another 2d array? or what should I do?
I'm so confused
extra..
this is for my dissertation I need to loop through the array and..
If it is an empty cell in the grid (2d array)
and 3 or more neighbouring cells are a grass object then create a grass object and place it in the empty space
Thank you very much for your help.