Maze generation algorithm