

Test: Will removing this wall merge two empty spaces of different label? Remove the index form the list ( never test a wall twice).Randomly choose a wall from the index list.Label all empty spaces with a unique label.The current maze is a grid with isolated empty spaces. So, the start for a 17x16 looks like this (Start is red, goal is green): (if at least one dimension is even-sized, this will be the case.) If the destination voxel is a wall, remove the wall.Set the voxel of index (n,m.) to be the goal destination.Set the voxel of index (0,0.) to be the starting location.remove the according index from the listĮssentially set the two opposing "corners" to be start and end.Store the wall-voxel index in the list.

MAZE GENERATOR ALGORITHM VERIFICATION
Hence there is no 100% verification it is correct.
MAZE GENERATOR ALGORITHM CODE
I do not post code here, but the algorithm concept. This algorithm works for n-dimensional mazes and arbitrary maze dimensions. (With or without hole close to the "exit" and "entry" points depending on your liking.) If you require the maze to be "enwalled" you need to use a 14x15 dimension in my algorithm and then draw a border of wall around it. Note that you ask for a 16 x 17 maze requiring each point either wall or empty.

This is an adapted version of the algorithm posted at this question.
