async function tracePath(entry, current_node, grid, setGrid, isInProgress) {
  let pathLength = 0;
  // if entry and exit are next to each other
  if (entry.isEqual(current_node)) {
    return pathLength;
  }

  // Start marking the path with a small delay
  while (isInProgress.current && !current_node.isEqual(entry)) {
    setGridCell(grid, setGrid, current_node.coords.x, current_node.coords.y, pathType, entry);
    await delay(100);
    current_node = current_node.parent;
    pathLength += 1;
  }

  return pathLength;
}
/**
 * Reverse traces the path from exit to entry using parents info
 * @param {PathNode} entry - The Entry PathNode.
 * @param {PathNode} current_node - The PathNode we ended on.
 * @param {number[][]} grid - The grid of cells.
 * @param {function} setGrid - The function for setting the grid.
 * @param {boolean} isInProgress - False if reset or random board has been pressed.
 * @returns {number} - The length of the path we found.
 */
Reverse traces the path from exit to entry using parents info
@param {PathNode} entry - The Entry PathNode.
Reverse traces the path from exit to entry using parents info @param { PathNode } entry - The Entry PathNode .
async function tracePath(entry, current_node, grid, setGrid, isInProgress) {
  let pathLength = 0;
  if (entry.isEqual(current_node)) {
    return pathLength;
  }
  while (isInProgress.current && !current_node.isEqual(entry)) {
    setGridCell(grid, setGrid, current_node.coords.x, current_node.coords.y, pathType, entry);
    await delay(100);
    current_node = current_node.parent;
    pathLength += 1;
  }
  return pathLength;
}
async function tracePath ( entry , current_node , grid , setGrid , isInProgress ) { let pathLength = 0 ; if ( entry . isEqual ( current_node ) ) { return pathLength ; } while ( isInProgress . current && ! current_node . isEqual ( entry ) ) { setGridCell ( grid , setGrid , current_node . coords . x , current_node . coords . y , pathType , entry ) ; await delay ( 100 ) ; current_node = current_node . parent ; pathLength += 1 ; } return pathLength ; }
Reverse traces the path from exit to entry using parents info
 @param {PathNode} entry - The Entry PathNode.
Reverse traces the path from exit to entry using parents info @param { PathNode } entry - The Entry PathNode .
// if entry and exit are next to each other // Start marking the path with a small delay