From 3f9cfd121aa7470e673c1e9ede0f2dc655554d92 Mon Sep 17 00:00:00 2001 From: Eric Wagoner Date: Wed, 3 Dec 2025 10:41:21 -0500 Subject: [PATCH] More template tweaks --- day-template/code.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/day-template/code.js b/day-template/code.js index 54f290d..3218827 100644 --- a/day-template/code.js +++ b/day-template/code.js @@ -1,12 +1,21 @@ import { readFileSync } from 'node:fs'; -const inputArray = readFileSync('sample.txt').toString().split("\n"); -// const inputArray = readFileSync('input.txt').toString().split("\n"); +let sampleMode = true; +let usedArray = []; + +const sampleArray = readFileSync('sample.txt').toString().split("\n"); +const inputArray = readFileSync('input.txt').toString().split("\n"); + +if (sampleMode) { + usedArray = sampleArray; +} else { + usedArray = inputArray; +} // Part One console.time("part1"); -for (const element of inputArray) { +for (const element of usedArray) { const contents = element.split(" "); } @@ -18,11 +27,12 @@ console.log(); // Part Two console.time("part2"); -for (const element of inputArray) { +for (const element of usedArray) { const contents = element.split(" "); } -console.log(); console.timeEnd("part2"); +console.log(); + // functions