day8

package
v0.0.0-...-e8b311c Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Part1

func Part1(network Network) int

Part1 calculates the number of steps it takes to go from AAA to ZZZ in the network. Directions are repeated as many times as needed to traverse the network.

func Part2

func Part2(network Network) int

Part2 starts at every node ending in 'A' simultaneously, and returns the number of steps until all nodes end with Z.

Types

type Network

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

Network consists of a list of directions and a graph of nodes.

func LoadNetwork

func LoadNetwork(filename string) (Network, error)

LoadNetwork loads a network from the given file. The first line of the file is a list of L and R instructions, and subsequent lines are nodes in the network.

Jump to

Keyboard shortcuts

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