exercises

package
v0.0.0-...-41fa42d Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2025 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateScoreDown

func CalculateScoreDown(h, r, c int, m [][]int) int

CalculateScoreDown calculates the score for the tree at the given location.

func CalculateScoreLeft

func CalculateScoreLeft(h, r, c int, m [][]int) int

CalculateScoreLeft calculates the score for the tree at the given location.

func CalculateScoreRight

func CalculateScoreRight(h, r, c int, m [][]int) int

CalculateScoreRight calculates the score for the tree at the given location.

func CalculateScoreUp

func CalculateScoreUp(h, r, c int, m [][]int) int

CalculateScoreUp calculates the score for the tree at the given location.

func GetTreeMap

func GetTreeMap(data []string) [][]int

GetTreeMap takes the input data and creates a 2D array of trees.

func GetVisibleTreesFromEast

func GetVisibleTreesFromEast(tm [][]int) []int

GetVisibleTreesFromEast returns the visible trees from the east.

func GetVisibleTreesFromNorth

func GetVisibleTreesFromNorth(tm [][]int) []int

GetVisibleTreesFromNorth returns the visible trees from the north.

func GetVisibleTreesFromSouth

func GetVisibleTreesFromSouth(tm [][]int) []int

GetVisibleTreesFromSouth returns the visible trees from the south.

func GetVisibleTreesFromWest

func GetVisibleTreesFromWest(tm [][]int) []int

GetVisibleTreesFromWest returns the visible trees from the west.

Types

type Coordinate

type Coordinate struct {
	X int
	Y int
}

Coordinate is a type that represents a coordinate.

type Exercise

type Exercise struct {
	common.BaseExercise
}

Exercise for Advent of Code 2022 day 8.

func (Exercise) One

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

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

func (Exercise) Two

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

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

type Tree

type Tree struct {
	Name     string
	Location Coordinate
	Height   int
}

Tree is a type that represents a tree.

type Visibility

type Visibility int

Visibility is a type that represents the visibility of a tree.

const (
	Unknown Visibility = iota // default behavior of "Unknown" visibility is by design.
	Yes
	No
)

Visibility is a type that represents the visibility of a tree.

Jump to

Keyboard shortcuts

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