To set the root path, the generator goes through every cell of the map from top to bottom, left to right. While previously creating the floors, every cell the digger created was identified by a sequential number starting at 1 which is the location of the base entrance known as the root cell. For each floor cell this part of the process verifies, it compares the ID of it with the ID of all surrounding floor cells. The path to the root is toward the cell that has the smallest ID. For example, if the digger generated these cell numbers while digging: This would generate the following root path: When the cell is a ladder or elevator, the generator appropriately compares the ID of the floor below or above. In the end, we have all the arrows pointing in toward their smallest sibling that eventually leads to the smallest of them all: The root.
|