How this works:
Rule based.
Every segment has to:
-on the creation turn, roll a 3-sided dice. (Don't ask.)
-if the dice number is:
1: create another segment ontop
2: create another segment to the right
3: create another segment to the left
-which ever segment got created must decrease their "size" variable by one
-create four walls, pointing to each side
-end turn.
Every wall has to:
-check if it's touching another wall. If it is, Destroy self, same with the colliding wall.
-repeat
Side rules
-if a segment generates on of another segment, float up by one.
-when the "size" variable reaches zero, generate the exit flag.