Skip to content

Commit

Permalink
Fix bug with recursive DFS
Browse files Browse the repository at this point in the history
  • Loading branch information
Lennard Schober committed May 2, 2024
1 parent 2c133e3 commit c246203
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions js/scripts2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1549,11 +1549,13 @@ async function generateRecursiveDFS() {
// open one random side of end point if encased
if (!endHasEmptyNeighbors()) {
let temp = getClosedSides();
console.log(temp)
console.log(tRow, tCol);
shuffle(temp);
const [dx, dy] = temp[0];
const mx = tCol + dx;
const my = tRow + dy;
globalGrid[my][mx] = 0; // Make the wall a passage
const mx = tRow + dx;
const my = tCol + dy;
globalGrid[mx][my] = 0; // Make the wall a passage
}

stopper = 0;
Expand Down

0 comments on commit c246203

Please sign in to comment.