'matrix with nodes that refer to which openings/connections they have

I would like some help on a problem that has been stressing me for a while now It revolves around recurdive backtracking maze generation, but should reurn a matrix filled with string values which are used to refer to which opening a room has,( the matrix contains the rooms btw ) so a matrix:

d, dr l
ud ur dl
ur lr ul
would show this in my program:

enter image description here

here is my code so far it is very messy just trying to get it working: https://paste.myst.rs/fjp8ksgp



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source