Positions of rooms are stored in the list. V key to view variables. Space key to reset rules. Flag to generate a new layout.
Made for a game. Code by me with slight inspirations for the method from others.