Problem 1. (15 points) Your new game engine has procedurally generated buildings. The method works recursively. Start with a rectangle and cut it by a horizontal or vertical line, called a wall, that contains a single gap, called a door. This splits the original rectangle into two subrectangles, called rooms, that are connected by this door (see the figure below (a)).
Apply the algorithm recursively to each of the rooms, with the added restriction that each new wall cannot overlap an existing door. The recursion ends when the rooms are of a desired size. (The figure shows successive recursive levels and the final structure in (d).)
(a)
(b)
(c)
(d)
Answer each of the following questions.
(i) In order to generate n rooms in the final structure, what is the total number of walls (that is, splitting lines) that need to be generated?
(ii) We say that a path is simple if it does not pass through a door more than once (see the figure below (d)). True or False: Given any structure formed by this algorithm, and given any two points s and t in different rooms, there exists at least one simple path between them.
(iii) Two simple paths are said to be equivalent if they pass through the same doors in the same order. True or False: Given any structure formed by this algorithm, and given any two points s and t in different rooms, all simple paths are equivalent.
In each case, provide a short justification (perhaps a sentence or two). A formal proof is not required.