summaryrefslogtreecommitdiff
path: root/day-8/script.ts
diff options
context:
space:
mode:
Diffstat (limited to 'day-8/script.ts')
-rw-r--r--day-8/script.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/day-8/script.ts b/day-8/script.ts
index a9870c1..d2869b9 100644
--- a/day-8/script.ts
+++ b/day-8/script.ts
@@ -60,6 +60,12 @@ console.log({ result });
// $ neato graph.dot -Tpng -o out.png
const dotFile = "graph.dot";
fs.writeFileSync(dotFile, "digraph aoc {\n");
+startingNodes.forEach((node) => {
+ fs.appendFileSync(dotFile, ` ${nodes[node].name} [color=green];\n`);
+});
+terminalNodes.forEach((node) => {
+ fs.appendFileSync(dotFile, ` ${nodes[node].name} [color=red];\n`);
+});
nodes.forEach((node) => {
fs.appendFileSync(dotFile, ` ${node.name} -> ${nodes[node.left].name};\n`);
fs.appendFileSync(dotFile, ` ${node.name} -> ${nodes[node.right].name};\n`);