d0

Imports

Imports #

"bufio"
"fmt"
"io"
"log"
"strconv"
"advent2024/pkg/solver"
"advent2024/pkg/solver"
"context"
"fmt"
"io"
"strconv"

Constants & Variables

day var #

Solver name

var day = "d0"

Structs

PuzzleStruct struct #

PuzzleStruct

type PuzzleStruct struct {
input string
}

PuzzleStructWithCtx struct #

PuzzleStruct with Context

type PuzzleStructWithCtx struct {
PuzzleStruct
}

Functions

Init method #

Initializes the PuzzleStruct with input Return nil on success

func (p *PuzzleStruct) Init(reader io.Reader) error

InitCtx method #

Initializes the PuzzleStruct with input

func (p *PuzzleStructWithCtx) InitCtx(ctx context.Context, reader io.Reader) error

NewSolver function #

Constructor

func NewSolver() *PuzzleStruct

NewSolverWithCtx function #

Constructor

func NewSolverWithCtx() *PuzzleStructWithCtx

Solve method #

Solves the puzzle Accepts part as parameter Returns string containing the solution of the puzzle

func (p *PuzzleStruct) Solve(part int) (string, error)

SolveCtx method #

Solves the puzzle Accepts part as parameter Returns string containing the solution of the puzzle

func (p *PuzzleStructWithCtx) SolveCtx(ctx context.Context, part int) (string, error)

init function #

Registers day wih the registry

func init()

init function #

Registers day wih the registry

func init()

parseInput function #

Parses provided input Returns parsed string

func parseInput(sc *bufio.Scanner) (string, error)

validateInput function #

Validates parsed input Returns nil in case of successfull validation

func validateInput(entry string) error