Skip to content

sangster/adventofcode.com

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

190 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code

List of 2022 Solutions

Status

YearStarsComplete?
202226★
202150★
202050★
201950★
201828★
201700★
201600★
201500★

Usage

stack install

stack run 2022 01    # Execute the given day.
stack run 2022 last  # Execute the most recent day with a source file.
stack run 2022 all   # Execute every day with a source file.

stack ghci src/Y2022/Day01.hs # REPL
stack --profile run 2022 last -- +RTS -p -RTS # Profile the day.

# Profile memory usage.
stack --profile run  2022 last -- +RTS -p -hy && stack exec -- hp2ps -e8in -c aoc.hp

Notes

In the greatest of hackathon traditions, these solutions follow the Easiest Thing That Works™ methodology.

Creating a new Day source file

Download input file into data/inputs/

This file should have a one or two digit filename, with no extension. The input file must exist, even if then puzzle doesn’t supply one.

Run generate-sources.sh shell script

The shell script, scripts/generate-sources.sh, will create a boilerplate Haskell source file for any input files which don’t yet have one. It also generates a top-level source file, src/GeneratedSolutions.hs, which exports a catalogue of every available solution.

You can execute this script in multiple ways:

./scripts/generate-sources.sh
# or...
nix run .#generate-sources

# If this is running, it will generate sources anytime inputs are added:
nix run .#aoc-wait 2015 last

Example Template

module Y2015.Day01 (parts) where

parts = ( (part1, Nothing)
        , (part2, Nothing)
        , id
        )

part1 :: a -> String
part1 input = ""

part2 :: a -> String
part2 input = ""

About

Practising Haskell with AdventOfCode.com puzzles

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published