day04_2018

package
v0.0.0-...-359cf57 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	START_SHIFT = iota
	FALL_ASLEEP
	WAKE_UP
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GuardEvent

type GuardEvent struct {
	GuardID   int
	EventType int
	DateTime  time.Time
}

type GuardSchedule

type GuardSchedule struct {
	ID              int
	TotalTimeAsleep int
	SleepFrequency  [60]int
}

type GuardSchedules

type GuardSchedules struct {
	Schedules map[int]*GuardSchedule
}

func (GuardSchedules) GetMostSleepyGuard

func (gs GuardSchedules) GetMostSleepyGuard() int

func (GuardSchedules) RegisterSleepTime

func (gs GuardSchedules) RegisterSleepTime(guardID int, sleepStart time.Time, sleepEnd time.Time)

func (GuardSchedules) RegisterSleepTimeFromEvents

func (gs GuardSchedules) RegisterSleepTimeFromEvents(events []GuardEvent)

type Solver

type Solver struct {
	Events    []GuardEvent
	Schedules GuardSchedules
}

func NewSolver

func NewSolver() *Solver

func (*Solver) Part1

func (s *Solver) Part1() (string, error)

func (*Solver) Part2

func (s *Solver) Part2() (string, error)

func (*Solver) ProcessInput

func (s *Solver) ProcessInput(input string) error

Jump to

Keyboard shortcuts

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