• entries
292
557
• views
154104

## 1 Comment

Works fine here. The strategy started out fairly automatic, ala ConFusebox, with the pieces that have no choice as to how to orient themselves. After that I just rather speculated as to how to complete the puzzle and managed to do it. I suspect there are likely several solutions to each maze.

Still, a nice game. Good find.

As for speed, here's Eller's Maze Algorithm in ActionScript. It's fast.

createMaze = function(width, height)
{	// generate a maze using eller's algorithm. Does not generate left or top wall. Assume it's there.
var arrLeft = new Array();
var arrRight = new Array();
var retMaze = new Array();
var wallBelow = 0x01, wallRight = 0x02;

for(var a=[1]; a<=width; a++)
{
arrLeft[a] = a;
arrRight[a] = a;
}

for(var a=[1]; a<height; a++)
{
for(var b=[1]; b<=width; b++)
{
if(Math.ceil(randVal()*[5])>[2] && b!=width && arrRight[b] != b+[1])
{
arrLeft[arrRight[b]] = arrLeft[b+[1]];
arrRight[arrLeft[b+[1]]] = arrRight[b];
arrRight[b] = b+[1];
arrLeft[b+[1]] = b;
cellVal = [0];
}
else
cellVal = wallRight;

if(Math.ceil(randVal()*[5])>[2] && arrRight[b] != b)
{
arrLeft[arrRight[b]] = arrLeft[b];
arrRight[arrLeft[b]] = arrRight[b];
arrLeft[b] = arrRight[b] = b;
cellVal |= wallBelow;
}

retMaze.push(cellVal);
}
}

for(var b=[1]; b<=width; b++)
{
if((arrRight[b] != b+[1]) && (b!=width))
{
arrLeft[arrRight[b]] = arrLeft[b+[1]];
arrRight[arrLeft[b+[1]]] = arrRight[b];
arrRight[b] = b+[1];
arrLeft[b+[1]] = b;
cellVal = [0];
}
else
cellVal = wallRight;

retMaze.push(wallBelow | cellVal);
}

return retMaze;
}



## Create an account

Register a new account