day22

package
v0.0.0-...-9c9a4a3 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Void  = 0
	Space = ' '
	Wall  = '#'
	Tile  = '.'

	Right = '>'
	Left  = '<'
	Down  = 'v'
	Up    = '^'
)
View Source
const (
	Clockwise        = 'R'
	Counterclockwise = 'L'
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

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

func NewBoard

func NewBoard(m [][]byte, instructions []Instruction, wrapper Wrapper) Board

func (Board) Run

func (b Board) Run() int

type Coordinate

type Coordinate struct {
	Row int
	Col int
}

func (Coordinate) Add

func (c Coordinate) Add(other Coordinate) Coordinate

func (Coordinate) Next

func (c Coordinate) Next(dir byte) Coordinate

type Instruction

type Instruction struct {
	Action byte
	Steps  int
}

func (Instruction) IsRotation

func (ins Instruction) IsRotation() bool

type Parser

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

func NewParser

func NewParser(f string) *Parser

func (*Parser) Parse

func (p *Parser) Parse() ([][]byte, []Instruction)

type Position

type Position struct {
	Pos  Coordinate
	Face byte
}

func (*Position) Move

func (p *Position) Move(pos Position)

func (*Position) Rotate

func (p *Position) Rotate(dir byte)

type Wrapper

type Wrapper interface {
	Password(pos Position) int
	Next(pos *Position) Position
}

type Wrapper2D

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

func NewWrapper2D

func NewWrapper2D(grid [][]byte) Wrapper2D

func (Wrapper2D) Next

func (w Wrapper2D) Next(pos *Position) Position

func (Wrapper2D) Password

func (w Wrapper2D) Password(pos Position) int

type Wrapper3D

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

func NewWrapper3D

func NewWrapper3D(grid [][]byte) Wrapper3D

func (Wrapper3D) Next

func (w Wrapper3D) Next(pos *Position) Position

func (Wrapper3D) Password

func (w Wrapper3D) Password(pos Position) int

type Wrapper3DT

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

func NewWrapper3DT

func NewWrapper3DT(grid [][]byte) Wrapper3DT

func (Wrapper3DT) Next

func (w Wrapper3DT) Next(pos *Position) Position

func (Wrapper3DT) Password

func (w Wrapper3DT) Password(pos Position) int

Jump to

Keyboard shortcuts

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