Post by daisy_strike on Nov 13, 2010 9:32:43 GMT -5
It would be really helpful to have everyone test out this program, and just pound it. For the 50 rooms I went through the recursion seemed to be working and fast. But I'm a little worried there may be a memory leak. Or that It may lock up on some computers the recursion is a bit cheap... anyways pound it and tell me what you think. I would appreciate it.
For those wondering how I finally did the recursion...
//recursion bit
function knockcell(startX:int, startY){
recursecouunter++;
//trace("i hit" + recursecouunter);
var end_x = (CONST_DUNGEONSIZEWIDTH - 1);
var end_y = (CONST_DUNGEONSIZEHEIGHT - 3);
var maze_width = CONST_DUNGEONSIZEWIDTH;
var maze_height = CONST_DUNGEONSIZEHEIGHT;
var temp:int = new int();
maze_visited.mazeX = startX;
maze_visited.mazeY = startY;
//exit the recursion if you have found the exit
//trace("Square Spot: " + ((maze_visited.mazeY * CONST_DUNGEONSIZEWIDTH) + maze_visited.mazeX) + " Square type: " + dungeonNumber[(startY * CONST_DUNGEONSIZEWIDTH) + startX]);
if(dungeonNumber[(maze_visited.mazeY * CONST_DUNGEONSIZEWIDTH) + maze_visited.mazeX] == 2){
recursionFinish = true;
return;
}
else if (recursecouunter == 500) {
recursionFinish = false;
return;
}
else {
temp = int(Math.random()*6 + 1);
if (temp == 1 || temp == 2) {
if (dungeonNumber[(maze_visited.mazeY * CONST_DUNGEONSIZEWIDTH) + maze_visited.mazeX + 1] > 0) {
maze_visited.mazeX++;
}
}
else if (temp == 3 || temp == 4) {
if (dungeonNumber[(maze_visited.mazeY * CONST_DUNGEONSIZEWIDTH) + maze_visited.mazeX + CONST_DUNGEONSIZEWIDTH] > 0) {
maze_visited.mazeY++;
}
}
else if (temp == 5) {
if (dungeonNumber[(maze_visited.mazeY * CONST_DUNGEONSIZEWIDTH) + maze_visited.mazeX - 1] > 0) {
maze_visited.mazeX--;
}
}
else if (temp == 6) {
if (dungeonNumber[(maze_visited.mazeY * CONST_DUNGEONSIZEWIDTH) + maze_visited.mazeX - CONST_DUNGEONSIZEWIDTH] > 0) {
maze_visited.mazeY--;
}
}
knockcell(maze_visited.mazeX, maze_visited.mazeY);
}
}
Would you believe my co-workers called me and another worker a nerd for discussing recursion...
Daisy
For those wondering how I finally did the recursion...
//recursion bit
function knockcell(startX:int, startY){
recursecouunter++;
//trace("i hit" + recursecouunter);
var end_x = (CONST_DUNGEONSIZEWIDTH - 1);
var end_y = (CONST_DUNGEONSIZEHEIGHT - 3);
var maze_width = CONST_DUNGEONSIZEWIDTH;
var maze_height = CONST_DUNGEONSIZEHEIGHT;
var temp:int = new int();
maze_visited.mazeX = startX;
maze_visited.mazeY = startY;
//exit the recursion if you have found the exit
//trace("Square Spot: " + ((maze_visited.mazeY * CONST_DUNGEONSIZEWIDTH) + maze_visited.mazeX) + " Square type: " + dungeonNumber[(startY * CONST_DUNGEONSIZEWIDTH) + startX]);
if(dungeonNumber[(maze_visited.mazeY * CONST_DUNGEONSIZEWIDTH) + maze_visited.mazeX] == 2){
recursionFinish = true;
return;
}
else if (recursecouunter == 500) {
recursionFinish = false;
return;
}
else {
temp = int(Math.random()*6 + 1);
if (temp == 1 || temp == 2) {
if (dungeonNumber[(maze_visited.mazeY * CONST_DUNGEONSIZEWIDTH) + maze_visited.mazeX + 1] > 0) {
maze_visited.mazeX++;
}
}
else if (temp == 3 || temp == 4) {
if (dungeonNumber[(maze_visited.mazeY * CONST_DUNGEONSIZEWIDTH) + maze_visited.mazeX + CONST_DUNGEONSIZEWIDTH] > 0) {
maze_visited.mazeY++;
}
}
else if (temp == 5) {
if (dungeonNumber[(maze_visited.mazeY * CONST_DUNGEONSIZEWIDTH) + maze_visited.mazeX - 1] > 0) {
maze_visited.mazeX--;
}
}
else if (temp == 6) {
if (dungeonNumber[(maze_visited.mazeY * CONST_DUNGEONSIZEWIDTH) + maze_visited.mazeX - CONST_DUNGEONSIZEWIDTH] > 0) {
maze_visited.mazeY--;
}
}
knockcell(maze_visited.mazeX, maze_visited.mazeY);
}
}
Would you believe my co-workers called me and another worker a nerd for discussing recursion...
Daisy