aoc2015

package
v0.0.0-...-f50ab9b Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DAY_2015_02_DATA = `` /* 8111-byte string literal not displayed */
View Source
const DAY_2015_03_DATA = `` /* 8192-byte string literal not displayed */
View Source
const DAY_2015_05_DATA = `` /* 16999-byte string literal not displayed */
View Source
const DAY_2015_06_DATA = `` /* 9530-byte string literal not displayed */
View Source
const DAY_2015_07_DATA = `` /* 5302-byte string literal not displayed */
View Source
const DAY_2015_07_TEST_DATA = `123 -> x
456 -> y
x AND y -> d
x OR y -> e
x LSHIFT 2 -> f
y RSHIFT 2 -> g
NOT x -> h
NOT y -> i`
View Source
const DAY_2015_08_DATA = `` /* 6788-byte string literal not displayed */

Variables

This section is empty.

Functions

func IsNice

func IsNice(line string) bool

func IsNice2

func IsNice2(line string) bool

Types

type Application

type Application struct {
	CLI     *cli.CLI
	Verbose bool
}

func NewApplication

func NewApplication(cli *cli.CLI) Application

func (Application) Api

func (app Application) Api(day int) string

func (Application) GetMethod

func (app Application) GetMethod(methodName string) (reflect.Value, reflect.Value, bool)

func (Application) GetName

func (app Application) GetName() string

func (Application) GetPuzzle

func (app Application) GetPuzzle(year int, day int) utils.Puzzle

func (Application) Help

func (app Application) Help(cli *cli.CLI)

func (Application) List

func (app Application) List() string

func (Application) Render

func (app Application) Render(cli *cli.CLI)

func (Application) Run

func (app Application) Run(cli *cli.CLI)

func (Application) Summary

func (app Application) Summary(year int, day int) *utils.Summary

func (*Application) Y2015D02

func (app *Application) Y2015D02()

AOC_2015_02 is the entrypoint

func (*Application) Y2015D02P1

func (app *Application) Y2015D02P1()

func (*Application) Y2015D02P2

func (app *Application) Y2015D02P2()

--- Part Two --- The elves are also running low on ribbon. Ribbon is all the same width, so they only have to worry about the length they need to order, which they would again like to be exact.

The ribbon required to wrap a present is the shortest distance around its sides, or the smallest perimeter of any one face. Each present also requires a bow made out of ribbon as well; the feet of ribbon required for the perfect bow is equal to the cubic feet of volume of the present. Don't ask how they tie the bow, though; they'll never tell.

For example:

A present with dimensions 2x3x4 requires 2+2+3+3 = 10 feet of ribbon to wrap the present plus 2*3*4 = 24 feet of ribbon for the bow, for a total of 34 feet. A present with dimensions 1x1x10 requires 1+1+1+1 = 4 feet of ribbon to wrap the present plus 1*1*10 = 10 feet of ribbon for the bow, for a total of 14 feet. How many total feet of ribbon should they order?

func (*Application) Y2015D02_Summary

func (app *Application) Y2015D02_Summary() *utils.Summary

func (*Application) Y2015D03

func (app *Application) Y2015D03()

AOC_2015_03 is the entrypoint

func (*Application) Y2015D03P1

func (app *Application) Y2015D03P1()

func (*Application) Y2015D03P2

func (app *Application) Y2015D03P2()

func (*Application) Y2015D03_Summary

func (app *Application) Y2015D03_Summary() *utils.Summary

func (*Application) Y2015D04

func (app *Application) Y2015D04()

AOC_2015_03 is the entrypoint

func (*Application) Y2015D04P1

func (app *Application) Y2015D04P1()

func (*Application) Y2015D04P2

func (app *Application) Y2015D04P2()

func (*Application) Y2015D04_Summary

func (app *Application) Y2015D04_Summary() *utils.Summary

func (*Application) Y2015D05

func (app *Application) Y2015D05()

AOC_2015_05 is the entrypoint

func (*Application) Y2015D05P1

func (app *Application) Y2015D05P1()

func (*Application) Y2015D05P2

func (app *Application) Y2015D05P2()

func (*Application) Y2015D05_Summary

func (app *Application) Y2015D05_Summary() *utils.Summary

func (*Application) Y2015D06

func (app *Application) Y2015D06()

AOC_2015_05 is the entrypoint

func (*Application) Y2015D06P1

func (app *Application) Y2015D06P1()

func (*Application) Y2015D06P2

func (app *Application) Y2015D06P2()

You just finish implementing your winning light pattern when you realize you mistranslated Santa's message from Ancient Nordic Elvish.

The light grid you bought actually has individual brightness controls; each light can have a brightness of zero or more. The lights all start at zero.

The phrase turn on actually means that you should increase the brightness of those lights by 1.

The phrase turn off actually means that you should decrease the brightness of those lights by 1, to a minimum of zero.

The phrase toggle actually means that you should increase the brightness of those lights by 2.

What is the total brightness of all lights combined after following Santa's instructions?

For example:

turn on 0,0 through 0,0 would increase the total brightness by 1. toggle 0,0 through 999,999 would increase the total brightness by 2000000.

func (*Application) Y2015D06_Summary

func (app *Application) Y2015D06_Summary() *utils.Summary

func (*Application) Y2015D07

func (app *Application) Y2015D07()

AOC_2015_07 is the entrypoint

func (*Application) Y2015D07P1

func (app *Application) Y2015D07P1()

func (*Application) Y2015D07P2

func (app *Application) Y2015D07P2()

func (*Application) Y2015D07_Summary

func (app *Application) Y2015D07_Summary() *utils.Summary

func (*Application) Y2015D08

func (app *Application) Y2015D08()

AOC_2015_07 is the entrypoint

func (*Application) Y2015D08P1

func (app *Application) Y2015D08P1()

func (*Application) Y2015D08P2_inprogress

func (app *Application) Y2015D08P2_inprogress()

func (*Application) Y2015D08_Summary

func (app *Application) Y2015D08_Summary() *utils.Summary

type Circuit

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

func NewCircuit

func NewCircuit(instructions string) *Circuit

func (*Circuit) Evaluate

func (c *Circuit) Evaluate()

func (*Circuit) GetInstruction

func (c *Circuit) GetInstruction(key string) *CircuitInstruction

func (*Circuit) GetSignalValue

func (c *Circuit) GetSignalValue(key string) uint16

func (*Circuit) Size

func (c *Circuit) Size() int

type CircuitInstruction

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

func NewCircuitInstruction

func NewCircuitInstruction(line string) *CircuitInstruction

func (*CircuitInstruction) GetLeftRight

func (i *CircuitInstruction) GetLeftRight() []string

type Grid201503

type Grid201503 struct {
	Counter *goutils.Counter
	// contains filtered or unexported fields
}

func NewGrid201503

func NewGrid201503() *Grid201503

func (*Grid201503) East

func (grid *Grid201503) East()

func (*Grid201503) Increment

func (grid *Grid201503) Increment(x int, y int)

func (*Grid201503) North

func (grid *Grid201503) North()

func (*Grid201503) RoboEast

func (grid *Grid201503) RoboEast()

func (*Grid201503) RoboNorth

func (grid *Grid201503) RoboNorth()

func (*Grid201503) RoboSouth

func (grid *Grid201503) RoboSouth()

func (*Grid201503) RoboWest

func (grid *Grid201503) RoboWest()

func (*Grid201503) South

func (grid *Grid201503) South()

func (*Grid201503) West

func (grid *Grid201503) West()

type LightGrid

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

func NewLightGrid

func NewLightGrid() *LightGrid

func (*LightGrid) CountOnOff

func (grid *LightGrid) CountOnOff() (int, int)

func (*LightGrid) Execute

func (grid *LightGrid) Execute(instruction string)

func (*LightGrid) ExecuteAll

func (grid *LightGrid) ExecuteAll(instructions string)

func (*LightGrid) Get

func (grid *LightGrid) Get(x int, y int) bool

func (*LightGrid) ParseCoordinates

func (grid *LightGrid) ParseCoordinates(instruction string) (int, int, int, int)

func (*LightGrid) Toggle

func (grid *LightGrid) Toggle(x int, y int)

func (*LightGrid) TotalBrightness

func (grid *LightGrid) TotalBrightness() int

func (*LightGrid) TurnOff

func (grid *LightGrid) TurnOff(x int, y int)

func (*LightGrid) TurnOn

func (grid *LightGrid) TurnOn(x int, y int)

type Present

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

func NewPresent

func NewPresent(line string) *Present

func (*Present) Area

func (p *Present) Area() int

func (*Present) Perimeter

func (p *Present) Perimeter() int

func (*Present) Volume

func (p *Present) Volume() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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