Labyrinth generator and solver