advent2023

package
v0.0.0-...-a2894a6 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineGhostlyTripLength

func DetermineGhostlyTripLength(r io.Reader) int

func DetermineTotalGearRatio

func DetermineTotalGearRatio(partNumbers []PartNumber, gearLocations map[location.Coordinate]struct{}) int

func DetermineTripLength

func DetermineTripLength(r io.Reader) int

func DistanceToFurthestPipeFromStart

func DistanceToFurthestPipeFromStart(r io.Reader) int

func FindLowestLocation

func FindLowestLocation(r io.Reader, seedStrategies ...SeedStrategy) uint64

func FindMinimumViableGameConfigs

func FindMinimumViableGameConfigs(r io.Reader) []map[Color]int

func ProcessCalibrationDocument

func ProcessCalibrationDocument(r io.Reader) int

Types

type Card

type Card int
const (
	Joker Card = iota

	Two
	Three
	Four
	Five
	Six
	Seven
	Eight
	Nine
	Ten
	Jack
	Queen
	King
	Ace
)

type Color

type Color int
const (
	Red Color = iota
	Blue
	Green
)

type Constraint

type Constraint func(Game) bool

func LimitedColors

func LimitedColors(maxRed, maxBlue, maxGreen int) Constraint

type Cube

type Cube struct {
	Color Color
}

type Game

type Game struct {
	Number int
	Rounds []Round
}

func FindPossibleGames

func FindPossibleGames(r io.Reader, constraints ...Constraint) []Game

type Hand

type Hand struct {
	Cards []Card
	Type  HandType
}

func NewHand

func NewHand(cards []Card, rule Rule) Hand

func (*Hand) String

func (h *Hand) String() string

type HandType

type HandType int
const (
	HighCard HandType = iota
	OnePair
	TwoPair
	ThreeOfAKind
	FullHouse
	FourOfAKind
	FiveOfAKind
)

type Kerning

type Kerning int
const (
	Bad Kerning = iota
	Good
)

type PartNumber

type PartNumber struct {
	Number       int
	DigitLocales []location.Coordinate
}

func FindPartNumbers

func FindPartNumbers(r io.Reader) ([]PartNumber, map[location.Coordinate]struct{})

func (PartNumber) IsAdjacentToASymbol

func (p PartNumber) IsAdjacentToASymbol(symbolLocations map[location.Coordinate]struct{}) bool

func (PartNumber) IsAdjacentToLocation

func (p PartNumber) IsAdjacentToLocation(coordinate location.Coordinate) bool

type Pipe

type Pipe int
const (
	Vertical Pipe = iota
	Horizontal
	NortheastConnector
	NorthwestConnector
	SoutheastConnector
	SouthwestConnector
)

type PipeLocale

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

type RaceStrategy

type RaceStrategy struct {
	Winners        int
	RecordDistance int
	TimeAlloted    int
}

func FindWinningRaceStrategies

func FindWinningRaceStrategies(r io.Reader, kernings ...Kerning) []*RaceStrategy

func (*RaceStrategy) DetermineWinners

func (r *RaceStrategy) DetermineWinners()

type Reading

type Reading []int

func ExtrapolateSenorReadings

func ExtrapolateSenorReadings(r io.Reader) []Reading

type Round

type Round struct {
	Cubes        []Cube
	CubesByColor map[Color][]Cube
}

func NewRound

func NewRound(cubes []Cube) Round

type Rule

type Rule int
const (
	NoJokers Rule = iota
	JokersWild
)

type Scratchcard

type Scratchcard struct {
	Number         int
	Numbers        map[int]struct{}
	WinningNumbers map[int]struct{}
	Value          int
	NumMatches     int
}

func FindWinningScratchcards

func FindWinningScratchcards(r io.Reader) ([]Scratchcard, map[int]int)

func NewScratchCard

func NewScratchCard(number int, numbers, winningNumbers map[int]struct{}) Scratchcard

type SeedStrategy

type SeedStrategy int
const (
	Direct SeedStrategy = iota
	Pairwise
)

type Situation

type Situation struct {
	PipeLocales      []PipeLocale
	PipesByLocation  map[location.Point]PipeLocale
	StartingPosition location.Point
	CurrentPosition  location.Point
	Orientation      location.CardinalDirection
	Steps            int
}

func (*Situation) Advance

func (s *Situation) Advance()

type Wager

type Wager struct {
	Hand Hand
	Bid  int
}

func SortCamelCardWagers

func SortCamelCardWagers(r io.Reader, rules ...Rule) []Wager

func (*Wager) String

func (w *Wager) String() string

type Winner

type Winner struct {
	ChargingTime     int
	Rate             int
	DistanceTraveled int
}

Jump to

Keyboard shortcuts

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