Skip to content

Commit

Permalink
generate missing days
Browse files Browse the repository at this point in the history
  • Loading branch information
TimHi committed Dec 23, 2023
1 parent e29e0f8 commit 7adb303
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 86 deletions.
15 changes: 15 additions & 0 deletions Typescript/2023/src/days/__test__/day22.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

import { SolvePartOne, SolvePartTwo } from "../day22/day22";
import { describe, expect, test } from "vitest";

describe("Day 22 Part 01", () => {
test("Expected result", () => {
expect(SolvePartOne()).toBe(-1);
});
});

describe("Day 22 Part 02", () => {
test("Expected result", () => {
expect(SolvePartTwo()).toBe(-1);
});
});
15 changes: 15 additions & 0 deletions Typescript/2023/src/days/__test__/day23.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

import { SolvePartOne, SolvePartTwo } from "../day23/day23";
import { describe, expect, test } from "vitest";

describe("Day 23 Part 01", () => {
test("Expected result", () => {
expect(SolvePartOne()).toBe(-1);
});
});

describe("Day 23 Part 02", () => {
test("Expected result", () => {
expect(SolvePartTwo()).toBe(-1);
});
});
15 changes: 15 additions & 0 deletions Typescript/2023/src/days/__test__/day24.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

import { SolvePartOne, SolvePartTwo } from "../day24/day24";
import { describe, expect, test } from "vitest";

describe("Day 24 Part 01", () => {
test("Expected result", () => {
expect(SolvePartOne()).toBe(-1);
});
});

describe("Day 24 Part 02", () => {
test("Expected result", () => {
expect(SolvePartTwo()).toBe(-1);
});
});
16 changes: 16 additions & 0 deletions Typescript/2023/src/days/day22/day22.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as fs from "fs";

const isSample = true;

export function SolvePartOne(): number {
const fileName = isSample ? "/src/days/day22/sample.txt" : "/src/days/day22/full.txt";
const lines = fs.readFileSync(process.cwd() + fileName, "utf8").split("\n");

console.log("TBD");
return 0;
}

export function SolvePartTwo(): number {
console.log("TBD");
return 0;
}
Empty file.
16 changes: 16 additions & 0 deletions Typescript/2023/src/days/day23/day23.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as fs from "fs";

const isSample = true;

export function SolvePartOne(): number {
const fileName = isSample ? "/src/days/day23/sample.txt" : "/src/days/day23/full.txt";
const lines = fs.readFileSync(process.cwd() + fileName, "utf8").split("\n");

console.log("TBD2");
return 0;
}

export function SolvePartTwo(): number {
console.log("TBD2");
return 0;
}
Empty file.
16 changes: 16 additions & 0 deletions Typescript/2023/src/days/day24/day24.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as fs from "fs";

const isSample = true;

export function SolvePartOne(): number {
const fileName = isSample ? "/src/days/day24/sample.txt" : "/src/days/day24/full.txt";
const lines = fs.readFileSync(process.cwd() + fileName, "utf8").split("\n");

console.log("TBD");
return 0;
}

export function SolvePartTwo(): number {
console.log("TBD");
return 0;
}
Empty file.
101 changes: 15 additions & 86 deletions Typescript/2023/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,88 +1,17 @@
import { SolvePartOne, SolvePartTwo } from "./days/day01/day01";
import { SolvePartOne as SolvePartOneD2, SolvePartTwo as SolvePartTwoD2 } from "./days/day02/day02";
import { SolvePartOne as SolvePartOneD3, SolvePartTwo as SolvePartTwoD3 } from "./days/day03/day03";
import { SolvePartOne as SolvePartOneD4, SolvePartTwo as SolvePartTwoD4 } from "./days/day04/day04";
import { SolvePartOne as SolvePartOneD5, SolvePartTwo as SolvePartTwoD5 } from "./days/day05/day05";
import { SolvePartOne as SolvePartOneD6, SolvePartTwo as SolvePartTwoD6 } from "./days/day06/day06";
import { SolvePartOne as SolvePartOneD7, SolvePartTwo as SolvePartTwoD7 } from "./days/day07/day07";
import { SolvePartOne as SolvePartOneD8, SolvePartTwo as SolvePartTwoD8 } from "./days/day08/day08";
import { SolvePartOne as SolvePartOneD9, SolvePartTwo as SolvePartTwoD9 } from "./days/day09/day09";
import { SolvePartOne as SolvePartOneD10, SolvePartTwo as SolvePartTwoD10 } from "./days/day10/day10";
import { SolvePartOne as SolvePartOneD11, SolvePartTwo as SolvePartTwoD11 } from "./days/day11/day11";
import { SolvePartOne as SolvePartOneD12, SolvePartTwo as SolvePartTwoD12 } from "./days/day12/day12";
import { SolvePartOne as SolvePartOneD13, SolvePartTwo as SolvePartTwoD13 } from "./days/day13/day13";
import { SolvePartOne as SolvePartOneD14, SolvePartTwo as SolvePartTwoD14 } from "./days/day14/day14";
import { SolvePartOne as SolvePartOneD15, SolvePartTwo as SolvePartTwoD15 } from "./days/day15/day15";
import { SolvePartOne as SolvePartOneD16, SolvePartTwo as SolvePartTwoD16 } from "./days/day16/day16";
import { SolvePartOne as SolvePartOneD17, SolvePartTwo as SolvePartTwoD17 } from "./days/day17/day17";
import { SolvePartOne as SolvePartOneD18, SolvePartTwo as SolvePartTwoD18 } from "./days/day18/day18";
import { SolvePartOne as SolvePartOneD19, SolvePartTwo as SolvePartTwoD19 } from "./days/day19/day19";
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 = 20;
// Import all solver functions dynamically
const solvers = [];
for (let i = 1; i <= 24; i++) {
solvers[i] = require(`./days/day${i.toString().padStart(2, "0")}/day${i.toString().padStart(2, "0")}`);
}

const day: number = 23;

if (day >= 1 && day <= 24) {
const solvePartOne = solvers[day].SolvePartOne;
const solvePartTwo = solvers[day].SolvePartTwo;

if (day === 1) {
console.log("Day 01 Part 01: " + SolvePartOne());
console.log("Day 01 Part 02: " + SolvePartTwo());
} else if (day === 2) {
console.log("Day 02 Part 01: " + SolvePartOneD2());
console.log("Day 02 Part 02: " + SolvePartTwoD2());
} else if (day === 3) {
console.log("Day 03 Part 01: " + SolvePartOneD3());
console.log("Day 03 Part 02: " + SolvePartTwoD3());
} else if (day === 4) {
console.log("Day 04 Part 01: " + SolvePartOneD4());
console.log("Day 04 Part 02: " + SolvePartTwoD4());
} else if (day === 5) {
console.log("Day 05 Part 01: " + SolvePartOneD5());
console.log("Day 05 Part 02: " + SolvePartTwoD5());
} else if (day === 6) {
console.log("Day 06 Part 01: " + SolvePartOneD6());
console.log("Day 06 Part 02: " + SolvePartTwoD6());
} else if (day === 7) {
console.log("Day 07 Part 01: " + SolvePartOneD7());
console.log("Day 07 Part 02: " + SolvePartTwoD7());
} else if (day === 8) {
console.log("Day 08 Part 01: " + SolvePartOneD8());
console.log("Day 08 Part 02: " + SolvePartTwoD8());
} else if (day === 9) {
console.log("Day 09 Part 01: " + SolvePartOneD9());
console.log("Day 09 Part 02: " + SolvePartTwoD9());
} else if (day === 10) {
console.log("Day 10 Part 01: " + SolvePartOneD10());
console.log("Day 10 Part 02: " + SolvePartTwoD10());
} else if (day === 11) {
console.log("Day 11 Part 01: " + SolvePartOneD11());
console.log("Day 11 Part 02: " + SolvePartTwoD11());
} else if (day === 12) {
console.log("Day 12 Part 01: " + SolvePartOneD12());
console.log("Day 12 Part 02: " + SolvePartTwoD12());
} else if (day === 13) {
console.log("Day 13 Part 01: " + SolvePartOneD13());
console.log("Day 13 Part 02: " + SolvePartTwoD13());
} else if (day === 14) {
console.log("Day 14 Part 01: " + SolvePartOneD14());
console.log("Day 14 Part 02: " + SolvePartTwoD14());
} else if (day === 15) {
console.log("Day 15 Part 01: " + SolvePartOneD15());
console.log("Day 15 Part 02: " + SolvePartTwoD15());
} else if (day === 16) {
console.log("Day 16 Part 01: " + SolvePartOneD16());
console.log("Day 16 Part 02: " + SolvePartTwoD16());
} else if (day === 17) {
console.log("Day 17 Part 01: " + SolvePartOneD17());
console.log("Day 17 Part 02: " + SolvePartTwoD17());
} else if (day === 18) {
console.log("Day 18 Part 01: " + SolvePartOneD18());
console.log("Day 18 Part 02: " + SolvePartTwoD18());
} else if (day === 19) {
console.log("Day 19 Part 01: " + SolvePartOneD19());
console.log("Day 19 Part 02: " + SolvePartTwoD19());
} else if (day === 20) {
console.log("Day 20 Part 01: " + SolvePartOneD20());
console.log("Day 20 Part 02: " + SolvePartTwoD20());
} else if (day === 21) {
console.log("Day 21 Part 01: " + SolvePartOneD21());
console.log("Day 21 Part 02: " + SolvePartTwoD21());
console.log(`Day ${day} Part 01: ${solvePartOne()}`);
console.log(`Day ${day} Part 02: ${solvePartTwo()}`);
} else {
console.log("Invalid day input");
}

0 comments on commit 7adb303

Please sign in to comment.