It looks like in every horizontal hallway (run of adjacent empty squares), there is at least one exit in the next row; i.e. at least one empty square.
Furthermore, there is definitely an even-odd row alternating pattern. The odd rows have more horizontal passages (runs of empty squares). The even rows have more single-square passages, as if connecting the odd rows. It's not entirely consistent across the field. It might be the result of some game-of-life like rules, like when multiple through-passages are clumped close together in the previous row, a connecting hallway will appear. Or, no, here is the thing. The algorithm avoids consecutive thick walls. So that is to say, if a given row has two or more adjacent walls ### there will be at most wall there in the next row. Nowhere in the maze animation do you see this:
##
##
###
(Assume we are scrolling upward, like a terminal, adding new rows at the bottom). You don't see consecutive thick walls. Always something like thisL ###
#
#
So for instance say we have this row: #### ## # #### # ###
Firstly, we ensure that all our spaces have at least one exit: #### ## # #### # ###
########################### ;; start with a filled row
Now punch the holes: #### ## # #### # ###
#### #### ########## # ####
Now, eliminate thick walls, careful not to make any new holes: #### ## # #### # ###
# # # ## ##### ### # ##
Now repeat: #### ## # #### # ### (a)
# # # ## ##### ### # ##
###########################
#### ## # #### # ### (b)
# # # ## ##### ### # ##
## # # ## ##### #### # ## #
#### ## # #### # ### (c)
# # # ## ##### ### # ##
## # # # # # # # #
Keep going: #### ## # #### # ### (a)
# # # ## ##### ### # ##
## # # # # # # # #
###########################
#### ## # #### # ### (a)
# # # ## ##### ### # ##
## # # # # # # # #
## # # ## # ## ## ##### # #
Notice that here we have very little to do for step (c); only one parallel thick wall has occurred: #### ## # #### # ### (c)
# # # ## ##### ### # ##
## # # # # # # # #
# # # ## # ## ## ##### # #
Then: #### ## # #### # ### (a)
# # # ## ##### ### # ##
## # # # # # # # #
# # # ## # ## ## ##### # #
###########################
#### ## # #### # ### (b)
# # # ## ##### ### # ##
## # # # # # # # #
# # # ## # ## ## ##### # #
## # # ## # ## ## ##### # #
#### ## # #### # ### (c)
# # # ## ##### ### # ##
## # # # # # # # #
# # # ## # ## ## ##### # #
## # # # # # # # # #
#### ## # #### # ### (a)
# # # ## ##### ### # ##
## # # # # # # # #
# # # ## # ## ## ##### # #
## # # # # # # # # #
###########################
#### ## # #### # ### (b)
# # # ## ##### ### # ##
## # # # # # # # #
# # # ## # ## ## ##### # #
## # # # # # # # # #
## # ## # # ### # ##### # #
#### ## # #### # ### (c)
# # # ## ##### ### # ##
## # # # # # # # #
# # # ## # ## ## ##### # #
## # # # # # # # # #
# # ## # # ### # ##### # #
The trouble is that we have parallel, disjoint passages.We need one more behavior, so that the adjacent passages can merge together. For instance, sometimes if we have _#_ (space hash space), we replace the hash with a space. Or something like that.
An important observation is that not only do parallel walls not occur, but parallel passages do not occur. I.e we don't see two spaces going to two spaces:
## ##
## ##
In a two space hallway, we can carve out at most one exit into the next row. So if we then remove additional walls to make spaces, we have to keep that in mind; don't do it in such a way that parallel passages would arise.