2024-12-04 22:27:23 +01:00
|
|
|
import type { Solvable } from "./solvable.ts";
|
|
|
|
|
|
|
|
const solutionFiles = Deno.readDirSync('./solutions');
|
|
|
|
|
|
|
|
const solvables: Solvable[] = [];
|
|
|
|
|
|
|
|
// need to wrap this stuff in a function to not trip the top level await
|
|
|
|
(async () => {
|
|
|
|
// cool dynamic module loading
|
2024-12-07 23:07:55 +01:00
|
|
|
for (const solution of solutionFiles) {
|
2024-12-04 22:27:23 +01:00
|
|
|
await import('./solutions/' + solution.name)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (import.meta.main) {
|
|
|
|
// only solve the latest day
|
2024-12-07 23:07:55 +01:00
|
|
|
solvables.toReversed()[0].part1().then(solvable => solvable.part2())
|
2024-12-04 22:27:23 +01:00
|
|
|
}
|
|
|
|
})()
|
|
|
|
|
|
|
|
|
|
|
|
export { solvables }
|