aoc2018

package
v0.0.0-...-7357ec6 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DAY_2018_09_DATA = `` /* 717-byte string literal not displayed */
View Source
const DAY_2018_09_TEST_DATA = `London to Dublin = 464
London to Belfast = 518
Dublin to Belfast = 141`
View Source
const DAY_2018_10_DATA = `` /* 17379-byte string literal not displayed */
View Source
const DAY_2018_10_DATA_TEST = `` /* 1115-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

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) Y2018D09P1_inprogress

func (app *Application) Y2018D09P1_inprogress()

rename this to the year and day in question

func (*Application) Y2018D09P2_inprogress

func (app *Application) Y2018D09P2_inprogress()

rename this to the year and day in question

func (*Application) Y2018D09_Summary

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

func (*Application) Y2018D10P1

func (app *Application) Y2018D10P1()

rename this to the year and day in question

func (*Application) Y2018D10P2

func (app *Application) Y2018D10P2()

rename this to the year and day in question

func (*Application) Y2018D10_Summary

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

func (*Application) Y202018D09

func (app *Application) Y202018D09()

this is what we will reflect and call - so both parts with run. It's up to you to make it print nicely etc. The app reference has a CLI for logging.

func (*Application) Y202018D10

func (app *Application) Y202018D10()

this is what we will reflect and call - so both parts with run. It's up to you to make it print nicely etc. The app reference has a CLI for logging.

type Grid

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

func NewGrid

func NewGrid() *Grid

func (*Grid) AddPoint

func (g *Grid) AddPoint(p *Point)

func (*Grid) Bounds

func (g *Grid) Bounds() (int, int, int, int, int, int)

func (*Grid) Compare

func (g *Grid) Compare(letter []string, x int, y int) (bool, []string)

indicates if the position x,y matches the passed search expression letter

func (*Grid) CountLetters

func (g *Grid) CountLetters() int

func (*Grid) Debug

func (g *Grid) Debug()

func (*Grid) Draw

func (g *Grid) Draw()

func (*Grid) FindMovingBoundaryPoints

func (g *Grid) FindMovingBoundaryPoints() (*Point, *Point, *Point, *Point)

returns the outermost points moving in their "opposite" direction

func (*Grid) Get

func (g *Grid) Get(x int, y int) *Point

func (*Grid) IsH

func (g *Grid) IsH(point *Point) bool

func (*Grid) Load

func (g *Grid) Load(lines []string)

func (*Grid) Remap

func (g *Grid) Remap()

func (*Grid) Snapshot

func (g *Grid) Snapshot(x int, y int, width int, height int) []string

func (*Grid) Step

func (g *Grid) Step(remap bool)

type Location

type Location struct {
	Name             string
	SourceCount      int // number of ties this location is a source
	DestinationCount int // number of times it is a destination
}

type Path

type Path struct {
	Routes   []*Route
	Distance int
}

the path a->b

func (*Path) AddRoute

func (path *Path) AddRoute(route *Route)

func (*Path) GetEnd

func (path *Path) GetEnd() *Route

func (*Path) GetStart

func (path *Path) GetStart() *Route

type Point

type Point struct {
	Key string
	// contains filtered or unexported fields
}

func NewPoint

func NewPoint(line string) *Point

func (*Point) Debug

func (p *Point) Debug()

func (*Point) Remap

func (p *Point) Remap()

func (*Point) Step

func (p *Point) Step(remap bool)

type Route

type Route struct {
	OriginalLine string
	Source       string
	Target       string
	Distance     int
	Key          string
}

func NewRoute

func NewRoute(line string) *Route

func (*Route) Debug

func (route *Route) Debug() string

type RouteLogic

type RouteLogic struct {
	Routes    []*Route
	Locations map[string]*Location
}

func NewRouteLogic

func NewRouteLogic(data string) *RouteLogic

func (*RouteLogic) Analsyse

func (logic *RouteLogic) Analsyse()

func (*RouteLogic) FindFirstAndLastLocations

func (logic *RouteLogic) FindFirstAndLastLocations() (*Location, *Location)

func (*RouteLogic) GetLocation

func (logic *RouteLogic) GetLocation(name string) *Location

Jump to

Keyboard shortcuts

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