generated from eric/adventofcode2023
More template tweaks
This commit is contained in:
@@ -1,12 +1,21 @@
|
|||||||
import { readFileSync } from 'node:fs';
|
import { readFileSync } from 'node:fs';
|
||||||
|
|
||||||
const inputArray = readFileSync('sample.txt').toString().split("\n");
|
let sampleMode = true;
|
||||||
// const inputArray = readFileSync('input.txt').toString().split("\n");
|
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
|
// Part One
|
||||||
|
|
||||||
console.time("part1");
|
console.time("part1");
|
||||||
for (const element of inputArray) {
|
for (const element of usedArray) {
|
||||||
const contents = element.split(" ");
|
const contents = element.split(" ");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,11 +27,12 @@ console.log();
|
|||||||
// Part Two
|
// Part Two
|
||||||
|
|
||||||
console.time("part2");
|
console.time("part2");
|
||||||
for (const element of inputArray) {
|
for (const element of usedArray) {
|
||||||
const contents = element.split(" ");
|
const contents = element.split(" ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log();
|
|
||||||
console.timeEnd("part2");
|
console.timeEnd("part2");
|
||||||
|
console.log();
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
|
|||||||
Reference in New Issue
Block a user