GithubHelp home page GithubHelp logo

tommyengstrom / advent-of-code-2017 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mstksg/advent-of-code-2017

0.0 1.0 0.0 610 KB

Advent of Code 2017 (Warning: Spoilers)

License: BSD 3-Clause "New" or "Revised" License

Haskell 100.00%

advent-of-code-2017's Introduction

Advent of Code 2017

Warning: Spoilers

I try to reflect on every day's puzzle, attempting to describe my thought processes and how my solutions all work. Benchmarks also included.

Executable

Comes with test examples given in problems.

You can install using stack:

$ git clone https://github.com/mstksg/advent-of-code-2017
$ cd advent-of-code-2017
$ stack setup
$ stack install

The executable aoc2017 includes a testing and benchmark suite

$ aoc2017 --help
aoc2017 - Advent of Code 2017 challenge runner

Usage: aoc2017 DAY [PART] [-t|--tests] [-b|--bench]
  Run challenges from Advent of Code 2017

Available options:
  DAY                      Day of challenge (1 - 25), or "all"
  PART                     Challenge part (a, b, c, etc.)
  -t,--tests               Run sample tests
  -b,--bench               Run benchmarks
  -h,--help                Show this help text

$ aoc2017 5 b
>> Day 05b
>> [✓] 27720699

Benchmarking is implemented using criterion

$ aoc2017 2 --bench
>> Day 02a
benchmarking...
time                 729.1 μs   (695.0 μs .. 784.2 μs)
                     0.967 R²   (0.926 R² .. 0.995 R²)
mean                 740.4 μs   (711.9 μs .. 783.6 μs)
std dev              116.8 μs   (70.44 μs .. 172.8 μs)
variance introduced by outliers: 89% (severely inflated)

>> Day 02b
benchmarking...
time                 782.4 μs   (761.3 μs .. 812.9 μs)
                     0.983 R²   (0.966 R² .. 0.998 R²)
mean                 786.7 μs   (764.1 μs .. 849.4 μs)
std dev              110.8 μs   (42.44 μs .. 228.5 μs)
variance introduced by outliers: 86% (severely inflated)

Test suites run the example problems given in the puzzle description, and outputs are colorized in ANSI terminals.

$ aoc2017 1 --tests
[9] [!35732] $ aoc2017 1 --tests
>> Day 01a
[✓] (3)
[✓] (4)
[✓] (0)
[✓] (9)
[✓] Passed 4 out of 4 test(s)
[✓] 1097
>> Day 01b
[✓] (6)
[✓] (0)
[✓] (4)
[✓] (12)
[✓] (4)
[✓] Passed 5 out of 5 test(s)
[✓] 1188

This should only work if you're running aoc2017 in the project directory.

To run on actual inputs, the executable expects inputs to be found in the folder data/XX.txt in the directory you are running in. That is, the input for Day 7 will be expected at data/07.txt.

aoc2017 will download missing input files, but requires a session token. This can be provided in aoc2017-conf.yaml:

session:  [[ session token goes here ]]

You can "lock in" your current answers (telling the executable that those are the correct answers) by passing in --lock. This will lock in any final puzzle solutions encountered as the verified official answers. Later, if you edit or modify your solutions, they will be checked on the locked-in answers.

These are store in data/ans/XXpart.txt. That is, the target output for Day 7 (Part 2, b) will be expected at data/ans/07b.txt. You can also manually edit these files.

advent-of-code-2017's People

Contributors

mstksg avatar frerich avatar

Watchers

Tommy Engström avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.