day3

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(schematic Schematic) int

Part1 sums the numbers that are adjacent to at least one symbol, even diagonally.

func Part2

func Part2(schematic Schematic) int

Part2 sums the gear ratios in the engine, where a gear ratio is the product of the two numbers adjacent to a '*'. '*'s that don't have exactly two adjacent numbers don't have a gear ratio.

Types

type Position

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

Position is a row and column in the schematic. It can indicate the start of a number, or the position of a symbol.

type Schematic

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

Schematic is a parsed schematic containing numbers, symbols, and their positions

func LoadSchematic

func LoadSchematic(filename string) (Schematic, error)

LoadSchematic loads a schematic from the given file. The schematic contains numbers, symbols, and periods.

Jump to

Keyboard shortcuts

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