async function shortestPath(passcode) {
const queue = [{ x: 0, y: 0, path: "" }];
while (queue.length > 0) {
const { x, y, path } = queue.shift();
if (x === 3 && y === 3) {
return path;
}
for (const move of await validMoves(x, y, path, passcode)) {
const [dx, dy] = directions[move];
queue.push({ x: x + dx, y: y + dy, path: path + move });
}
}
}