Skip to content

petertseng/adventofcode-hs-2019

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code

Build Status

These are my solutions to http://adventofcode.com

All solutions are written in Haskell.

I didn't feel like writing day 25.

Input

In general, all solutions can be invoked in both of the following ways:

  • Without command-line arguments, takes input on standard input.
  • With 1+ command-line arguments, reads input from the first, which must be the path to an input file. Arguments beyond the first are ignored.

Some may additionally support other ways:

  • All intcode days: May pass the intcode in ARGV as a single argument separated by commas.
  • Day 04 (Password): May pass min and max in ARGV (as two args, or as one arg joined by a hyphen).

Closing thoughts

Non-strict evaluation comes in handy, especially when different days might share a common approach but impose different termination conditions. For example, some days want to BFS all goals, but some just want to BFS a single goal. In other languages, that is most conveniently achieved by adding a parameter that controls how many goals the BFS attempts to find. In Haskell, the BFS simply attempts to find them all, and if a day only wants one goal, it only asks for one. Thus, the others don't get computed.

I can apparently be extraordinarily uncreative with names - use git grep "''" to see how many times I use ''.

About

Solutions to https://adventofcode.com/2019 (all but day 25, unlikely to add day 25 due to lack of interest)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages