summaryrefslogtreecommitdiff
path: root/aoc/day.go
diff options
context:
space:
mode:
Diffstat (limited to 'aoc/day.go')
-rw-r--r--aoc/day.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/aoc/day.go b/aoc/day.go
new file mode 100644
index 0000000..7505223
--- /dev/null
+++ b/aoc/day.go
@@ -0,0 +1,19 @@
+package aoc
+
+import (
+ "bufio"
+ "context"
+)
+
+type Reader[T any] interface {
+ Read(ctx context.Context, scanner *bufio.Scanner) (T, error)
+}
+
+type Solver[T any, R any] interface {
+ Solve(ctx context.Context, data T) (R, error)
+}
+
+func RunDay[T any, R any](ctx context.Context, in Reader[T], solvers ...Solver[T, R]) {
+ ctx, cancel := context.WithCancel(ctx)
+ defer cancel()
+}