day01_2019

package
v0.0.0-...-359cf57 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package day01_2019 contains the solver for Advent of Code - Day 1: The Tyranny of the Rocket Equation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeFuelForFuel

func ComputeFuelForFuel(fuel int) int

ComputeFuelForFuel computes the fuel required for the specified amount of fuel. And the fuel for that fuel. And the fuel for that fuel...

func ComputeFuelForMass

func ComputeFuelForMass(mass int) int

ComputeFuelForMass computes the fuel requirements for a specific mass.

Types

type Solver

type Solver struct {
	// List of masses to be used for the code of both parts
	Masses []int
}

Solver implements the Solver interface for the puzzle for day 1.

func NewSolver

func NewSolver() *Solver

NewSolver returns a new solver

func (*Solver) Part1

func (s *Solver) Part1() (string, error)

Part1 solves part 1 of the puzzle. Required to implement Solver.

func (*Solver) Part2

func (s *Solver) Part2() (string, error)

Part2 solves part 2 of the puzzle. Required to implement Solver.

func (*Solver) ProcessInput

func (s *Solver) ProcessInput(fileContent string) error

ProcessInput processes the input by transforming it into a slice of masses (ints) saved in the struct. Required to implement Solver.

Jump to

Keyboard shortcuts

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