day09

package
v0.0.0-...-fe2311f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DirUp    = Dir{X: 0, Y: -1}
	DirDown  = Dir{X: 0, Y: 1}
	DirLeft  = Dir{X: -1, Y: 0}
	DirRight = Dir{X: 1, Y: 0}
)
View Source
var Cmds = map[string]Dir{
	"U": DirUp,
	"D": DirDown,
	"L": DirLeft,
	"R": DirRight,
}

Functions

func MoveN

func MoveN(r *linkedlist.Node[*Knot], d Dir, dist int)

func NewRope

func NewRope(len int) *linkedlist.Node[*Knot]

func SimulateMoves

func SimulateMoves(r *linkedlist.Node[*Knot], mvs []string)

Types

type Dir

type Dir grid.Point

type Knot

type Knot struct {
	Pos grid.Point
	// contains filtered or unexported fields
}

func (*Knot) Visit

func (k *Knot) Visit()

func (Knot) Visited

func (k Knot) Visited() []grid.Point

Jump to

Keyboard shortcuts

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