exercises

package
v0.0.0-...-e61498d Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHeight

func GetHeight(c rune) int

GetHeight calculates the height of of a map location. a = 0 -> z = 25.

func PopulateFromInput

func PopulateFromInput(data []string) (graph.Graph[Point, Location], Point, Point, error)

PopulateFromInput populates the graph with the input data and sets up possible travel between points.

func PrintPath

func PrintPath(path []Point, data []string)

PrintPath prints the path on the map.

Types

type Exercise

type Exercise struct {
	common.BaseExercise
}

Exercise for Advent of Code 2022 day 12

func (Exercise) One

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

One returns the answer to the first part of the exercise. incorrect: 354 answer: 330

func (Exercise) Two

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

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

type Location

type Location struct {
	Coord  Point
	Height int
}

Location is a set of coordinates on the map with a height.

type Point

type Point struct {
	X int
	Y int
}

Point is an X, Y coordinate.

Jump to

Keyboard shortcuts

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