d15

package
v0.0.0-...-f50ab9b Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const REAL_DATA = `` /* 2500-byte string literal not displayed */
View Source
const TEST_DATA = `` /* 737-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type Beacon

type Beacon struct {
	Point *Point
}

func NewBeacon

func NewBeacon(input string) *Beacon

func (*Beacon) String

func (b *Beacon) String() string

type Grid

type Grid struct {
	MinX    int
	MaxX    int
	MaxY    int
	MinY    int
	Beacons []*Beacon
	Sensors []*Sensor
	// contains filtered or unexported fields
}

func NewGrid

func NewGrid(data string) *Grid

func (*Grid) AddBeacon

func (g *Grid) AddBeacon(beacon *Beacon)

func (*Grid) AddSensor

func (g *Grid) AddSensor(sensor *Sensor)

func (*Grid) Bounds

func (g *Grid) Bounds() (int, int, int, int)

func (*Grid) Contains

func (g *Grid) Contains(x int, y int, p *Point) bool

func (*Grid) CountCannotBePresent

func (g *Grid) CountCannotBePresent(VERBOSE bool, row int) int

func (*Grid) CountGaps

func (g *Grid) CountGaps(VERBOSE bool, row int) (int, int)

func (*Grid) CountMissing

func (g *Grid) CountMissing(VERBOSE bool, row int) []int

func (*Grid) Debug

func (g *Grid) Debug() string

func (*Grid) Get

func (g *Grid) Get(x int, y int) *Point

func (*Grid) GetSegments

func (g *Grid) GetSegments(VERBOSE bool, row int) []*Segment

func (*Grid) Height

func (g *Grid) Height() int

func (*Grid) Put

func (g *Grid) Put(x int, y int, p *Point)

func (*Grid) Width

func (g *Grid) Width() int

type Point

type Point struct {
	X      int
	Y      int
	Beacon *Beacon
	Sensor *Sensor
}

func NewPoint

func NewPoint(input string) *Point

func (*Point) Distance

func (p *Point) Distance(p2 *Point) int

func (*Point) DistanceTo

func (p *Point) DistanceTo(x int, y int) int

func (*Point) String

func (p *Point) String() string

type Puzzle

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

func NewPuzzle

func NewPuzzle() *Puzzle

func NewPuzzleWithData

func NewPuzzleWithData(input string) *Puzzle

func (*Puzzle) Load

func (puzzle *Puzzle) Load(input string)

func (*Puzzle) Part1_x

func (puzzle *Puzzle) Part1_x()

func (*Puzzle) Part1_y

func (puzzle *Puzzle) Part1_y()

func (*Puzzle) Part2_x

func (puzzle *Puzzle) Part2_x()

func (*Puzzle) Part2_y

func (puzzle *Puzzle) Part2_y()

func (*Puzzle) Run

func (puzzle *Puzzle) Run()

type Segment

type Segment struct {
	MinX int
	MaxX int
}

func NewSegment

func NewSegment(minx int, maxx int) *Segment

func RemoveSegmentAtIndex

func RemoveSegmentAtIndex(segments []*Segment, removeIndex int) []*Segment

func (*Segment) Integrate

func (s *Segment) Integrate(VERBOSE bool, other *Segment) bool

func (*Segment) IsInsideOf

func (s *Segment) IsInsideOf(other *Segment) bool

func (*Segment) IsOverlappedBy

func (s *Segment) IsOverlappedBy(other *Segment) bool

func (*Segment) OverlapsToLeftOf

func (s *Segment) OverlapsToLeftOf(other *Segment) bool

func (*Segment) OverlapsToRightOf

func (s *Segment) OverlapsToRightOf(other *Segment) bool

func (*Segment) OverlapsWith

func (s *Segment) OverlapsWith(other *Segment) bool

func (*Segment) String

func (s *Segment) String() string

type Sensor

type Sensor struct {
	Point    *Point
	Beacon   *Beacon
	Strength int
}

func NewSensor

func NewSensor(input string) *Sensor

func (*Sensor) String

func (s *Sensor) String() string

Jump to

Keyboard shortcuts

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