I have this tile-based game I've been messing around with and I want to have a way to check if a set of wall tiles make an enclosed space.
Here's some more details: I have a tile map. Each tile has an ID. If you have a set of IDs like so:
0,0,0,0,0
0,1,1,1,0
0,1,2,1,0
0,1,1,1,0
0,0,0,0,0
0 is grass, 1 is wall, and 2 is floor. Assuming these have a spot in a 2d array, how can I find and confirm if whether or not the floor tile is surrounded by walls. This method has to be scalable as well. So if the floor area is 2x2 it would still work.
I've already tried implementing a way to check it, but I failed on my first couple of tries. Any recommendations?
Maze Solving
orGame Of Life
algorithms \$\endgroup\$