Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Day11 ¶
Day11 is the exercise environment.
func (*Day11) ParseInput ¶
ParseInput puts monkey information into struct
func (*Day11) ProcessRound ¶
ProcessRound processes a round of monkeys.
func (*Day11) ProcessRoundPart2 ¶
ProcessRoundPart2 processes a round of monkeys.
type Exercise ¶
type Exercise struct {
common.BaseExercise
}
Exercise for Advent of Code 2022 day 11
type Monkey ¶
type Monkey struct { ID int Items []int Divisor int Operator string Scalar int TargetOne int TargetTwo int Count int }
Monkey struct represents necessary aspect of a monkey for day 11. Items is a slice of worry levels for each item currently held by this monkey. Operation is a function that modifies a worry level after inspected. Test determines where an item is moved after inspection based on worry level.
func ParseMonkey ¶
ParseMonkey parses a single monkey.
type MonkeyHeap ¶
type MonkeyHeap []Monkey
MonkeyHeap implements heap.Interface and holds Monkeys. Ref https://golang.org/pkg/container/heap/
func (MonkeyHeap) Len ¶
func (h MonkeyHeap) Len() int
Len is the number of elements in the collection.
func (MonkeyHeap) Less ¶
func (h MonkeyHeap) Less(i, j int) bool
Less is greater-than here so we can pop *larger* items.
func (*MonkeyHeap) Pop ¶
func (h *MonkeyHeap) Pop() interface{}
Pop removes and returns the maximum element (according to Less) from the heap.
func (*MonkeyHeap) Push ¶
func (h *MonkeyHeap) Push(x interface{})
Push pushes the element x onto the heap.
func (MonkeyHeap) Swap ¶
func (h MonkeyHeap) Swap(i, j int)
Swap swaps the elements with indexes i and j.