I'm working on a tile based city builder. Currently the way the data is stored is an array of objects. Within each object, it has information like its location and other tile properties,
State.land = [
{ location: [0, 0] },
{ location: [0, 1] },
{ location: [1, 1] },
{ location: [1, 2] },
{ location: [-1, 0] },
]
The player can click on spots next to existing locations which would push a new object with the location into the land array.
Currently working on a delete method. You can only delete a land if all adjacent lands can reach [0, 0] ([0, 0] is not delete-able)
Im thinking this would be a good way to implement a nice path finding algorithm and DFS was the first that came into mind.
I've only ever implemented DFS while leetcoding but it's been awhile since I last done it. Would DFS be a good option for this problem?