Existing source for labyrinth creation

It may be only 20 lines, but I still don't wanna lose it...