walk2 = {
if (input === sample1) return "not applicable";
return "too slow";
let n = 0;
let nodes = Array.from(graph.keys()).filter((d) => d.endsWith("A"));
const paths = nodes.map(() => []);
while (!nodes.every((node) => node.endsWith("Z"))) {
for (const [i, node] of nodes.entries()) {
paths[i].push(node);
paths[i] = paths[i].slice(-10);
nodes[i] = graph.get(node)[instructions[n % instructions.length]];
}
n++;
if (n % 1000 === 0) yield { n, paths, nodes };
}
return yield paths;
}