Hey guys,
I was going to make a program that would find the outer edges that do not equal to null(0).
I currently have two arrays, one with all the information in it from where I will find the edges, and one of them that will point out where the edges are at.
So here's an example of what I'm trying to accomplish, and I have attempted many times but failed due to lack of performance, or lack of ideas.
Information Array:
0-0-0-0-0-0-0
0-#-#-#-#-#-0
0-#-#-0-#-#-0
0-#-#-#-#-#-0
0-#-#-#-#-#-0
If the above grid is our information array, or from where to find the edges, our edges array would result in another two dimensional array as the following:
Edges Array:
0-0-0-0-0-0-0
0-#-#-#-#-#-0
0-#-0-0-0-#-0
0-#-0-0-0-#-0
0-#-#-#-#-#-0
Now obviously, this would simply mean that I would do a basic for loop for every direction and see where it hits. At least, that's what I thought until I realised that if there is a hole:
0-0-0-0-0-0-0
0-#-#-#-#-#-0
0-0-0-#-#-#-0
0-#-0-#-#-#-0
0-#-#-#-#-#-0
It wouldn't know that there are actually objects where the "@" is located.
0-0-0-0-0-0-0
0-#-#-#-#-#-0
0-0-0-#-#-#-0
0-#-@-#-#-#-0
0-#-#-#-#-#-0
Does anyone have any clues on how to perform this action?