Documentation ¶
Index ¶
- Variables
- func Abs(x int) int
- func Max(x, y int) int
- func MaxInts(ns []int) (int, error)
- func Min(x, y int) int
- func MinInts(ns []int) (int, error)
- func ReadDigits(in string) ([]int, error)
- func ReadIntLines(r io.Reader) ([][]int, error)
- func ReadInts(name string) ([]int, error)
- func ReadStringGroups(name string) ([][]string, error)
- func ReadStrings(name string) ([]string, error)
- type CompassDirection
- type HexDirection
- type WXYZ
- type XY
- type XYZ
Constants ¶
This section is empty.
Variables ¶
View Source
var Compass = map[CompassDirection]XY{ North: {0, 1}, East: {1, 0}, South: {0, -1}, West: {-1, 0}, }
View Source
var Directions = []XY{ {-1, -1}, Compass[West], {-1, 1}, Compass[South], Compass[North], {1, -1}, Compass[East], {1, 1}, }
View Source
var ErrEmptySlice = errors.New("advent2020: slice is empty")
View Source
var ErrNoResult = errors.New("advent2020: no result found")
View Source
var HexCompass = map[HexDirection]XYZ{ HexEast: {1, -1, 0}, HexSouthEast: {0, -1, 1}, HexSouthWest: {-1, 0, 1}, HexWest: {-1, 1, 0}, HexNorthWest: {0, 1, -1}, HexNorthEast: {1, 0, -1}, }
https://www.redblobgames.com/grids/hexagons/#coordinates-cube
Functions ¶
func ReadDigits ¶
func ReadStringGroups ¶
ReadStringGroups reads a file of string data formed of groups of lines, where groups are separated by an empty line.
func ReadStrings ¶
Types ¶
type CompassDirection ¶
type CompassDirection int
const ( North CompassDirection = iota East South West )
func (CompassDirection) RotateAnticlockwise ¶
func (d CompassDirection) RotateAnticlockwise(steps int) CompassDirection
func (CompassDirection) RotateClockwise ¶
func (d CompassDirection) RotateClockwise(steps int) CompassDirection
type HexDirection ¶
type HexDirection int
const ( HexEast HexDirection = iota HexSouthEast HexSouthWest HexWest HexNorthWest HexNorthEast )
Click to show internal directories.
Click to hide internal directories.