aoc

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package aoc contains functionalities related to Advent of Code.

Index

Constants

View Source
const FirstYear = Year(2015)

FirstYear is the year when the first Advent of Code was released.

Variables

View Source
var Timezone = time.FixedZone("EST/UTC-5", -5*60*60)

Timezone is when Eric Wastl unlocks the Advent of Code puzzles.

Functions

func CreateInputReq added in v0.4.4

func CreateInputReq(d Date, sessionID string) (*http.Request, error)

CreateInputReq creates an HTTP request for retrieving the Advent of Code input given d.

Types

type AdventYears added in v0.4.3

type AdventYears []Year

AdventYears represents a collection of Advent of Code years.

func Years

func Years() AdventYears

Years returns all released AoCs years in ascending order. It should be noted that this uses the local time of the user's machine. Which when messed with could lead to an incorrect list of AoC years.

func (AdventYears) FirstYearDir added in v0.4.3

func (years AdventYears) FirstYearDir(cwd string) (Year, string, error)

FirstYearDir tries to find and return a path of the first aoc year where the year exists as a dir in the given cwd.

func (AdventYears) Len added in v0.4.3

func (years AdventYears) Len() int

func (AdventYears) Less added in v0.4.3

func (years AdventYears) Less(i, j int) bool

func (AdventYears) Swap added in v0.4.3

func (years AdventYears) Swap(i, j int)

type Date added in v0.4.4

type Date struct {
	Year
	Day
}

Date represents an Advent of Code date

type DatePart added in v0.4.4

type DatePart struct {
	Date
	Part
}

DatePart represents an Advent of Code date for a solution.

type Day

type Day int

Day represents a day in an Advent of Code year.

const (
	FirstDay Day = 1
	LastDay      = FirstDay + 24
)

First and last Day constants.

func (Day) String added in v0.4.3

func (d Day) String() string

type Part

type Part rune

Part represents a part in a single Advent of Code day.

const (
	Part1 Part = iota + 'A'
	Part2
)

First and last Part constants.

func (Part) String

func (p Part) String() string

type Year added in v0.4.3

type Year int

Year represents an Advent of Code year.

func LastYear added in v0.4.3

func LastYear() Year

LastYear yields the most recent Advent of Code year.

func (Year) FindDir added in v0.4.3

func (y Year) FindDir(cwd string) (string, error)

FindDir tries to find the Advent of Code year as a dir in given the cwd.

func (Year) String added in v0.4.3

func (y Year) String() string

Jump to

Keyboard shortcuts

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