aoc2017-0.1.0.0: Advent of Code 2017 - my answers

Safe HaskellSafe
LanguageHaskell2010

Day11

Description

 

Synopsis

Documentation

data Step Source #

A single step on a hexagonal grid.

Constructors

N 
NE 
SE 
S 
SW 
NW 

data Pos Source #

A position on a hexagonal grid, in trapezoidal coordinates.

Constructors

Pos

The distance along the N/S axis is given by x + y.

Fields

  • x :: !Int

    The distance along the NE/SW axis.

  • y :: !Int

    The distance along the NW/SE axis.

data Chart Source #

A representation of all hexagons touched along a path.

Constructors

Chart 

Fields

parse :: String -> [Step] Source #

Parse comma-separated steps.

step :: Pos -> Step -> Pos Source #

Move from a position by one step.

walk :: Pos -> Int Source #

Returns the minimum number of steps required to reach the origin.