d18

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 = `` /* 21697-byte string literal not displayed */
View Source
const TEST_DATA = `2,2,2
1,2,2
3,2,2
2,1,2
2,3,2
2,2,1
2,2,3
2,2,4
2,2,6
1,2,5
3,2,5
2,1,5
2,3,5`

Variables

This section is empty.

Functions

func Key

func Key(x int, y int, z int) string

Types

type Cube

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

func NewCube

func NewCube(line string, solid bool) *Cube

func NewCubeX

func NewCubeX(x int, y int, z int, solid bool) *Cube

func (*Cube) Key

func (c *Cube) Key() string

func (*Cube) String

func (c *Cube) String() string

type Deque

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

func NewQ

func NewQ() *Deque

func (*Deque) Popleft

func (d *Deque) Popleft() *Cube

func (*Deque) Popright

func (d *Deque) Popright() *Cube

func (*Deque) Pushleft

func (d *Deque) Pushleft(c *Cube)

func (*Deque) Pushright

func (d *Deque) Pushright(c *Cube)

func (*Deque) Size

func (d *Deque) Size() int

type Grid

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

func NewGrid

func NewGrid(input string) *Grid

func (*Grid) Add

func (g *Grid) Add(c *Cube)

func (*Grid) Bounds

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

func (*Grid) CountSides

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

returns number of connected and open sizes

func (*Grid) CubesConnected

func (g *Grid) CubesConnected(x int, y int, z int) []*Cube

func (*Grid) Get

func (g *Grid) Get(x int, y int, z int) *Cube

func (*Grid) GetOrEmpty

func (g *Grid) GetOrEmpty(x int, y int, z int) *Cube

func (*Grid) NeighboursConnectable

func (g *Grid) NeighboursConnectable(x int, y int, z int) []*Point3D

returns all neighbouring coordinates that can be directly connected

func (*Grid) Size

func (g *Grid) Size() int

type Point3D

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

func NewPoint3D

func NewPoint3D(x int, y int, z int) *Point3D

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

func (puzzle *Puzzle) Part1()

func (*Puzzle) Part2

func (puzzle *Puzzle) Part2()

func (*Puzzle) Run

func (puzzle *Puzzle) Run()

Jump to

Keyboard shortcuts

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