day14

package
v0.0.0-...-a30599c Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OneFuel = Quantity{Material: "FUEL", Amount: 1}

OneFuel is a quantity for a single unit of fuel.

Functions

This section is empty.

Types

type Quantity

type Quantity struct {
	Material string
	Amount   int
}

Quantity represents a specific amount of a particular material

func (Quantity) String

func (q Quantity) String() string

type Rule

type Rule struct {
	Inputs []Quantity
	Output Quantity
}

Rule defines how an output can be constructed from some input materials.

func RuleFromString

func RuleFromString(s string) (Rule, error)

RuleFromString creates a new rule from its string representation.

func (Rule) String

func (r Rule) String() string

type Table

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

Table is a list of conversion rules between types of materials.

func TableFromString

func TableFromString(s string) (*Table, error)

TableFromString creates a conversion table from lines of rules.

func (*Table) RequiredOre

func (t *Table) RequiredOre(desired Quantity) int

RequiredOre returns the minimum amount of ore needed to produce the desired quantity of material with the rules in this table.

func (*Table) String

func (t *Table) String() string

Jump to

Keyboard shortcuts

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