Documentation
¶
Index ¶
- func Abs(n int) int
- func Day1(digits []byte) int
- func Day12(r io.Reader) int
- func Day2(spreadsheet [][]int) int
- func Day3(square int) int
- func Day4(passphrases []string) int
- func Day5Part1(maze []int) int
- func Day5Part2(maze []int) int
- func Day6Impl1(banks Banks, activeBanks int) int
- func Day6Impl2(banks []int) int
- func Day7(r io.Reader) string
- func Day8(r io.Reader) (int, error)
- func Day9(stream []byte) int
- func Delta(n int, axisfn func(float64) float64) int
- func Transform(n int, axisfn func(float64) float64, clockwise bool) int
- func X(n int) int
- func Y(n int) int
- type Banks
- type Cmp
- type Condition
- type Instruction
- type Operation
- type RA
- type Registers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Day3 ¶
Day3 returns the number of steps for a given square to square 1. A recursive implementation is used that produces a stack overflow for values around 1e8. The recursive call can be replaced by a loop based impl using Delta() only.
func Day4 ¶
Day4 returns the number of valid pass phrases valid := contains no duplicate words, separated by space
func Transform ¶
Helper will project a point on a spiral into either X or Y coordinates for both clockwise and counterclockwise spirals. projecting a spiral onto X and Y involves (co-)sine, and oeis has appropriate formulas (as always).
A174344 lists x-coordinates of point moving in clockwise spiral. https://oeis.org/A174344 A268038 lists y-coordinates of point moving in clockwise spiral. https://oeis.org/A268038