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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(i int) int

Abs returns the absolute value of an int.

func PrintState

func PrintState(tailLocation []Point)

PrintState prints the state of the grid.

Types

type Exercise

type Exercise struct {
	common.BaseExercise
}

Exercise for Advent of Code 2022 day 9

func (Exercise) One

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

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

func (Exercise) Two

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

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

type Point

type Point struct {
	X, Y int
}

Point is an x/y tuple of ints.

func CalculateMovement

func CalculateMovement(h, t Point) Point

CalculateMovement returns the movement of tail to follow the head. No movement is returned if the tail is within 1 of the head.

Jump to

Keyboard shortcuts

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