-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_common.ts
51 lines (46 loc) · 1.17 KB
/
_common.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
export interface Config {
options: Partial<Options>;
source: AocdSource;
}
// If you plan to update this interface, see the note on Config above.
export interface AocdSource {
getInput(year: number, day: number): Promise<string>;
submit(
year: number,
day: number,
part: number,
solution: Answer,
): Promise<boolean>;
}
// If you plan to update this interface, see the note on Config above.
export interface Options {
/**
* Show the runtimes of the solvers.
* @default false
*/
time: boolean;
/**
* Submit the answer to the AoC website.
* @default false
*/
submit: boolean;
/**
* Execute the solvers concurrently. Only has benefit if they're asynchronous functions.
* @default false
*/
concurrency: boolean;
/** @default true */
printResults: boolean;
/**
* When using concurrency mode, still print the results in order.
* @default true
*/
resultsInOrder: boolean;
}
export type Answer = number | string;
export type MaybeAnswer = Answer | null | undefined;
export type Solver = (input: string) => MaybeAnswer | Promise<MaybeAnswer>;
export interface PartResult {
answer: MaybeAnswer;
correct?: boolean;
}