On of the challenges faces with when building a random dungeon generator is building dungeons that are connected, and fully accessible by the player character. Could you imagine a map with a disjointed room that is inaccessible to the player, it could spell catastrophe if the exit to the map is located in a disjointed room, or imagine the players frustration upon seeing glorious loot that was located in an inaccessible location.
Thus the need for some code to deal with making sure the map is accessible.
I decided to implement a flood fill algorithm to take care of this for me.
The first iteration worked, but was a bit more code and then I small moment of genius, and instantly thought of a better way to do it via a recursive function. The latest iteration uses a less code and is more efficient, I could even remove some of the code, such as the 'adjoining_tile' parts, which I think I will do....
This brings my goal of enjoyable, procedural y generated content maps one step closer.