exercises

package
v0.0.0-...-85ad5c8 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Unlicense Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HexMove = map[string]Direction{
	"0": Right,
	"1": Down,
	"2": Left,
	"3": Up,
}
View Source
var Move = map[Direction]Point{
	Right: {1, 0},
	Left:  {-1, 0},
	Up:    {0, -1},
	Down:  {0, 1},
}
View Source
var MoveString = map[Point]string{
	{1, 0}:  "R",
	{-1, 0}: "L",
	{0, -1}: "U",
	{0, 1}:  "D",
}

Functions

This section is empty.

Types

type Direction

type Direction rune
const (
	Right Direction = 'R'
	Left  Direction = 'L'
	Up    Direction = 'U'
	Down  Direction = 'D'
)

type Exercise

type Exercise struct {
	common.BaseExercise
}

Exercise for Advent of Code 2023 day 18.

func (Exercise) One

func (e Exercise) One(instr string) (any, error)

One returns the answer to the first part of the exercise.

func (Exercise) Two

func (e Exercise) Two(instr string) (any, error)

Two returns the answer to the second part of the exercise.

type Lagoon

type Lagoon struct {
	Path  []Point
	Steps Steps
	Min   Point
	Max   Point
}

func (*Lagoon) DebugPrint

func (lg *Lagoon) DebugPrint()

func (*Lagoon) Height

func (lg *Lagoon) Height() int

func (*Lagoon) Width

func (lg *Lagoon) Width() int

type Point

type Point util.Point2D

func (Point) Add

func (p Point) Add(p2 Point) Point

func (Point) Move

func (p Point) Move(dir Direction, dist int) Point

func (Point) Mul

func (p Point) Mul(scalar int) Point

type Step

type Step struct {
	Value     string
	Direction Direction
	Distance  int
}

type Steps

type Steps []*Step

func (Steps) GetBoundaryPoints

func (ss Steps) GetBoundaryPoints() ([]Point, error)

Jump to

Keyboard shortcuts

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