runner

package
v0.0.0-...-f4b2804 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPartNotImplemented = errors.New("not implemented")

ErrPartNotImplemented is returned when a specific part (1 or 2) of a day's solution has not been implemented.

View Source
var ErrSolverNotImplemented = errors.New("solver not implemented")

ErrSolverNotImplemented is returned when the solver code is not added.

Functions

This section is empty.

Types

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner manages a collection of Solvers and provides methods to execute them.

func New

func New(solvers map[int]Solver) *Runner

New creates a new Runner instance with the provided map of solvers.

func (*Runner) RunPart1

func (r *Runner) RunPart1(day int, data string) (p1 int, err error)

RunPart1 executes the Part1 solution for the specified day with the given input data. Returns ErrSolverNotImplemented if no solver exists for the specified day.

func (*Runner) RunPart2

func (r *Runner) RunPart2(day int, data string) (p2 int, err error)

RunPart2 executes the Part2 solution for the specified day with the given input data. Returns ErrSolverNotImplemented if no solver exists for the specified day.

type Solver

type Solver interface {
	// Part1 solves the first part of the puzzle and returns the result.
	// It should return ErrSolverNotImplemented if the part is not yet implemented
	Part1(data string) (int, error)
	// Part2 solves the second part of the puzzle and returns the result.
	// It should return ErrSolverNotImplemented if the part is not yet implemented
	Part2(data string) (int, error)
}

Solver is the interface that must be implemented by each day's solution. It defines methods to solve both parts of an Advent of Code puzzle.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL