d9

Imports

Imports #

"bufio"
"container/list"
"fmt"
"io"
"log"
"strconv"
"strings"
"advent2024/pkg/solver"
"advent2024/pkg/solver"
"context"
"fmt"
"io"
"strconv"

Constants & Variables

day var #

var day = "d9"

Structs

Block struct #

type Block struct {
size int
blockid int
space bool
moved bool
}

PuzzleStruct struct #

type PuzzleStruct struct {
inputStr *string
inputInts *[]int
blockList list.List
}

PuzzleStructWithCtx struct #

type PuzzleStructWithCtx struct {
PuzzleStruct
}

Functions

Checksum function #

func Checksum(l *list.List) int

Init method #

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

InitCtx method #

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

NewSolver function #

func NewSolver() *PuzzleStruct

NewSolverWithCtx function #

func NewSolverWithCtx() *PuzzleStructWithCtx

Solve method #

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

SolveCtx method #

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

init function #

func init()

init function #

func init()

parseInput function #

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

tryToMove function #

func tryToMove(l *list.List, e *list.Element) (*list.Element, error)

validateInput function #

func validateInput(ints *[]int) error