32 lines
No EOL
705 B
TypeScript
32 lines
No EOL
705 B
TypeScript
import { Day } from "./day.ts";
|
|
|
|
const solutionFiles = Deno.readDirSync('./solutions');
|
|
|
|
const days: Day[] = [];
|
|
|
|
// need to wrap this stuff in a function to not trip the top level await
|
|
(async () => {
|
|
// cool dynamic module loading
|
|
for (const solution of solutionFiles) {
|
|
await import('./solutions/' + solution.name)
|
|
}
|
|
|
|
// only solve the latest day
|
|
const sortedDays = days.sort((dayL: Day, dayR: Day) => {
|
|
if (dayL.day < dayR.day) {
|
|
return -1
|
|
} else if (dayL.day > dayR.day) {
|
|
return 1
|
|
} else {
|
|
return 0
|
|
}
|
|
})
|
|
console.log("Solving latest day only:")
|
|
const day = sortedDays.reverse()[0];
|
|
|
|
day.part1()
|
|
day.part2()
|
|
})()
|
|
|
|
|
|
export { days as solvables } |