adventofcode-0.1.0.0: Haskell solutions to adventofcode
LicenseMIT
Maintainer@tylerjl
Safe HaskellSafe-Inferred
LanguageHaskell2010

Y2015.D06

Description

Solutions to the day 06 set of problems for adventofcode.com.

Synopsis

Documentation

testA #

Arguments

:: Instruction

Given Instruction.

-> Int

Number of lit lights.

Execute Instruction and return number of lit lights per part A spec.

testB #

Arguments

:: Instruction

Given Instruction

-> Int

Number of lit lights.

Execute Instruction and return number of lit lights per part B spec.

data Instruction #

Type of light grid instruction.

Constructors

On Range 
Off Range 
Toggle Range 

Instances

Instances details
Show Instruction # 
Instance details

Defined in Y2015.D06

data Range #

Represents a two-dimensional range of lights.

Constructors

Range Point Point 

Instances

Instances details
Show Range # 
Instance details

Defined in Y2015.D06

Eq Range # 
Instance details

Defined in Y2015.D06

Methods

(==) :: Range -> Range -> Bool Source #

(/=) :: Range -> Range -> Bool Source #

parseInstructions #

Arguments

:: String

Input string to parse.

-> [Instruction]

Either an error or parsed structure.

Parses a string into a list of Instructions.

configureGridA #

Arguments

:: Array U DIM2 Int

Light grid.

-> Instruction

Operation Instruction.

-> Array U DIM2 Int

Resultant light grid.

Folding function to aggregate computation for Instructions per part |A spec.

configureGridB #

Arguments

:: Array U DIM2 Int

Light grid.

-> Instruction

Operation Instruction.

-> Array U DIM2 Int

Resultant light grid.

Folding function to aggregate computation for Instructions per part |B spec.

lightSimulation #

Arguments

:: Foldable t 
=> (Array U DIM2 Int -> a -> Array U DIM2 Int)

REPA Light grid

-> t a

Instructions

-> Int

Lit lights

Run a light simulation