From d2d01bbd11479784655e6f61421a53b5a07f2c4c Mon Sep 17 00:00:00 2001 From: TimHi Date: Thu, 21 Dec 2023 17:22:29 +0100 Subject: [PATCH] WIP part 2 --- Typescript/2023/src/days/day20/Part2.ts | 26 +++++++++++++++++++++++++ Typescript/2023/src/days/day20/day20.ts | 5 +++-- Typescript/2023/src/main.ts | 2 +- 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 Typescript/2023/src/days/day20/Part2.ts diff --git a/Typescript/2023/src/days/day20/Part2.ts b/Typescript/2023/src/days/day20/Part2.ts new file mode 100644 index 0000000..5f1837d --- /dev/null +++ b/Typescript/2023/src/days/day20/Part2.ts @@ -0,0 +1,26 @@ +import * as fs from "fs"; + +interface Conjection { + id: string; + memory: Map; + destinations: string[]; + origins: string[]; +} + +interface FlipFlop { + id: string; + state: boolean; + destinations: string[]; + origins: string[]; +} + +function parseMap(isSample: boolean) { + const fileName = isSample ? "/src/days/day20/sample.txt" : "/src/days/day20/full.txt"; + fs.readFileSync(process.cwd() + fileName, "utf8") + .split("\n") + .forEach((line) => {}); +} + +export function CalculateNeededPresses(isSample: boolean): number { + return 0; +} diff --git a/Typescript/2023/src/days/day20/day20.ts b/Typescript/2023/src/days/day20/day20.ts index e59938f..9716cec 100644 --- a/Typescript/2023/src/days/day20/day20.ts +++ b/Typescript/2023/src/days/day20/day20.ts @@ -1,5 +1,6 @@ import { Queue } from "data-structure-typed"; import * as fs from "fs"; +import { CalculateNeededPresses } from "./Part2"; const isSample = true; @@ -39,8 +40,8 @@ export function SolvePartOne(): number { } export function SolvePartTwo(): number { - console.log("TBD"); - return 0; + const result = CalculateNeededPresses(isSample); + return result; } interface Signal { diff --git a/Typescript/2023/src/main.ts b/Typescript/2023/src/main.ts index c2a4f05..aa1bfed 100644 --- a/Typescript/2023/src/main.ts +++ b/Typescript/2023/src/main.ts @@ -20,7 +20,7 @@ import { SolvePartOne as SolvePartOneD19, SolvePartTwo as SolvePartTwoD19 } from import { SolvePartOne as SolvePartOneD20, SolvePartTwo as SolvePartTwoD20 } from "./days/day20/day20"; import { SolvePartOne as SolvePartOneD21, SolvePartTwo as SolvePartTwoD21 } from "./days/day21/day21"; //Please don't look at this file I dont care its ugly -const day: number = 21; +const day: number = 20; if (day === 1) { console.log("Day 01 Part 01: " + SolvePartOne());