summaryrefslogtreecommitdiff
path: root/day-8/script.ts
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-12-09 02:39:12 +0300
committereug-vs <eugene@eug-vs.xyz>2023-12-09 02:39:12 +0300
commitec85d11b49990cb8a2da6046553117b545130c48 (patch)
tree74fa73b1e9d5043c82a1a4398aace0ca3e735242 /day-8/script.ts
parenta65bf01f5a8aaed52f38bb27e7c99b88e8b9b0f6 (diff)
downloadaoc-2023-ec85d11b49990cb8a2da6046553117b545130c48.tar.gz
feat(day-8): add some color to visualization
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`);