Randomly generated dungeons are a lot of fun to program, but sometimes they can be pretty difficult to originally wrap your head around. For this years 7DRL I added Automata Generated Caverns as one of the algorithms I wanted to figure out completely. You can read more specifically on the theory here.