Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    292
  • comments
    557
  • views
    154104


1 Comment


Recommended Comments

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;
}

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!