this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

logging

+12
+12
2023/day08/part2.ts
··· 19 19 let paths = Object.keys(network).filter((n) => n.endsWith("A")); 20 20 let stepCount = 0; 21 21 22 + console.log(`network: ${Object.keys(network).length}`); 23 + console.log(`paths: ${paths.length}`); 24 + 22 25 while (!pathsFinished(paths)) { 23 26 for (const dir of instructions.split("")) { 27 + logPaths(stepCount, paths); 24 28 paths = step(paths, dir as keyof Node); 25 29 stepCount++; 26 30 if (pathsFinished(paths)) break; ··· 28 32 } 29 33 30 34 return stepCount; 35 + } 36 + 37 + function logPaths(stepCount: number, paths: string[]) { 38 + console.log( 39 + `${stepCount.toString().padStart(20, "0")} ${paths 40 + .map((p) => (p.endsWith("Z") ? "x" : ".")) 41 + .join("")}`, 42 + ); 31 43 } 32 44 33 45 if (import.meta.main) {