#111###### #222##22## #33333333x<- block removed from here ########## #111###### #222##22## #3333333x1 ########## #111###### #222##22## #333333x11 ########## #111###### #222##2x## #333333333 ########## #111###### #222##x2## #333333333 ########## Now, consider moving to the last block not allowed. Consider it a 3D case with a depth of 2. We're now at this situation. Note the additional blocking ## in the second depth plane. z=1 z=2 #111###### #111###### #222##x2## #222##22## #333333333 #33333##33 ########## ########## #111###### #111###### #222##22## #222##x2## #333333333 #33333##33 ########## ########## #111###### #111###### #222##22## #222##2x## #333333333 #33333##33 ########## ########## Now there is nowhere to go, without going to an already visited block, but the pressure calculated in here from neighboring blocks is >= 2, so it is not the final ending. We will back up to a state where there is somewhere to go to. It is this state: #111###### #111###### #222##22## #222##22## #333333x33 #33333##33 ########## ########## Then just go on, avoiding already visited blocks: #111###### #111###### #222##22## #222##22## #33333x333 #33333##33 ########## ########## #111###### #111###### #222##22## #222##22## #3333x3333 #33333##33 ########## ########## #111###### #111###### #222##22## #222##22## #333x33333 #33333##33 ########## ########## #111###### #111###### #222##22## #222##22## #33x333333 #33333##33 ########## ########## #111###### #111###### #22x##22## #222##22## #333333333 #33333##33 ########## ########## #11x###### #111###### #222##22## #222##22## #333333333 #33333##33 ########## ########## "Blob", the air bubble finally got out of the water. Then return recursively to a state where there is air next to water, clear the visit flags and feed the neighbor of the water recursively to the algorithm. #11 ###### #111###### #222##22## #222##22## #333333333x #33333##33 ########## ########## #11 ###### #111###### #222##22## #222##22## #33333333x3 #33333##33 ########## ########## ...and so on.