sln_2017_22
Copyright(c) Eric Mertens 2017
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Main

Description

Synopsis

Documentation

main :: IO () Source #

>>> :main
5399
2511776

data Status Source #

Constructors

Clean 
Weakened 
Infected 
Flagged 

Instances

Instances details
Eq Status Source # 
Instance details

Defined in Main

Methods

(==) :: Status -> Status -> Bool #

(/=) :: Status -> Status -> Bool #

rule1 :: Status -> Status Source #

Transition rule used in part 1

rule2 :: Status -> Status Source #

Transition rule used in part 2

turnRule :: Status -> Coord -> Coord Source #

Turn rule used by the virus carrier.

go Source #

Arguments

:: (Status -> Status)

update rule

-> Int

iterations remaining

-> Int

infection counter

-> Coord

facing direction

-> Coord

current location

-> Map Coord Status

world map

-> Int

infections caused after given iterations

Run the world simulation for a specified number of iterations. Returns the number of infections caused by the virus carrier.