2022-09-21 09:19:53 -04:00
|
|
|
defmodule AdventOfCode.PuzzleSolver do
|
|
|
|
@moduledoc """
|
|
|
|
Behaviour for a puzzle solution.
|
|
|
|
"""
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
Given the input as a stream, return the solution as a string
|
|
|
|
"""
|
2022-09-21 09:19:53 -04:00
|
|
|
@callback solve(Enumerable.t()) :: any()
|
2022-09-21 09:19:53 -04:00
|
|
|
|
|
|
|
def solve(mod, stream), do: apply(mod, :solve, [stream])
|
|
|
|
|
|
|
|
defmacro __using__(_) do
|
|
|
|
quote do
|
|
|
|
@behaviour AdventOfCode.PuzzleSolver
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|