commit 19c00785498badc0804a2c38ec1c700baf43561d Author: Jonathan Chan Date: Sun Nov 25 18:32:15 2018 -0800 Initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9df0582 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.stack-work/ +adventofcode.cabal +*~ \ No newline at end of file diff --git a/ChangeLog.md b/ChangeLog.md new file mode 100644 index 0000000..6973bf2 --- /dev/null +++ b/ChangeLog.md @@ -0,0 +1,3 @@ +# Changelog for adventofcode + +## Unreleased changes diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..70c4961 --- /dev/null +++ b/LICENSE @@ -0,0 +1,30 @@ +Copyright Jonathan Chan (c) 2018 + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of Jonathan Chan nor the names of other + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b61d024 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# Advent of Code 2018 + +## Blog Posts + +To arrive at [⟨ortho|normal⟩](https://hilb.ert.space) as December comes. + +## Runtimes + +| Day | Runtime (s) | With `-O2` | +|-----|-------------|------------| +| 01 | | +| 02 | | +| 03 | | +| 04 | | +| 05 | | +| 06 | | +| 07 | | +| 08 | | +| 09 | | +| 10 | | +| 11 | | +| 12 | | +| 13 | | +| 14 | | +| 15 | | +| 16 | | +| 17 | | +| 18 | | +| 19 | | +| 20 | | +| 21 | | +| 22 | | +| 23 | | +| 24 | | +| 25 | | diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..9a994af --- /dev/null +++ b/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/app/Main.hs b/app/Main.hs new file mode 100644 index 0000000..229a919 --- /dev/null +++ b/app/Main.hs @@ -0,0 +1,33 @@ +-- Some possibly-useful GHC extensions: +{-# LANGUAGE BangPatterns, TupleSections, ScopedTypeVariables, GADTs, GeneralizedNewtypeDeriving #-} + +module Main where + +import qualified Day01 +import qualified Day02 +import qualified Day03 +import qualified Day04 +import qualified Day05 +import qualified Day06 +import qualified Day07 +import qualified Day08 +import qualified Day09 +import qualified Day10 +import qualified Day11 +import qualified Day12 +import qualified Day13 +import qualified Day14 +import qualified Day15 +import qualified Day16 +import qualified Day17 +import qualified Day18 +import qualified Day19 +import qualified Day20 +import qualified Day21 +import qualified Day22 +import qualified Day23 +import qualified Day24 +import qualified Day25 + +main :: IO () +main = Day01.main diff --git a/input/01.txt b/input/01.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/02.txt b/input/02.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/03.txt b/input/03.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/04.txt b/input/04.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/05.txt b/input/05.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/06.txt b/input/06.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/07.txt b/input/07.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/08.txt b/input/08.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/09.txt b/input/09.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/10.txt b/input/10.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/11.txt b/input/11.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/12.txt b/input/12.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/13.txt b/input/13.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/14.txt b/input/14.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/15.txt b/input/15.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/16.txt b/input/16.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/17.txt b/input/17.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/18.txt b/input/18.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/19.txt b/input/19.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/20.txt b/input/20.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/21.txt b/input/21.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/22.txt b/input/22.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/23.txt b/input/23.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/24.txt b/input/24.txt new file mode 100644 index 0000000..e69de29 diff --git a/input/25.txt b/input/25.txt new file mode 100644 index 0000000..e69de29 diff --git a/package.yaml b/package.yaml new file mode 100644 index 0000000..cedb894 --- /dev/null +++ b/package.yaml @@ -0,0 +1,37 @@ +name: adventofcode +version: 0.1.0.0 +github: "ionathanch/adventofcode" +license: BSD3 +author: "Jonathan Chan" +maintainer: "afnl686@gmail.com" +copyright: "2018 Jonathan Chan" + +extra-source-files: +- README.md +- ChangeLog.md + +# Metadata used when publishing your package +# synopsis: Short description of your package +# category: Web + +# To avoid duplicated efforts in documentation and dealing with the +# complications of embedding Haddock markup inside cabal files, it is +# common to point users to the README.md file. +description: Please see the README on GitHub at + +dependencies: +- base >= 4.7 && < 5 + +library: + source-dirs: src + +executables: + adventofcode-exe: + main: Main.hs + source-dirs: app + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + dependencies: + - adventofcode diff --git a/src/Day01.hs b/src/Day01.hs new file mode 100644 index 0000000..dedd480 --- /dev/null +++ b/src/Day01.hs @@ -0,0 +1,6 @@ +module Day01 (main) where + +main :: IO () +main = do + input <- readFile "input/01.txt" + print input \ No newline at end of file diff --git a/src/Day02.hs b/src/Day02.hs new file mode 100644 index 0000000..493d4d3 --- /dev/null +++ b/src/Day02.hs @@ -0,0 +1,6 @@ +module Day02 (main) where + +main :: IO () +main = do + input <- readFile "input/02.txt" + print input \ No newline at end of file diff --git a/src/Day03.hs b/src/Day03.hs new file mode 100644 index 0000000..2029982 --- /dev/null +++ b/src/Day03.hs @@ -0,0 +1,6 @@ +module Day03 (main) where + +main :: IO () +main = do + input <- readFile "input/03.txt" + print input \ No newline at end of file diff --git a/src/Day04.hs b/src/Day04.hs new file mode 100644 index 0000000..24ce415 --- /dev/null +++ b/src/Day04.hs @@ -0,0 +1,6 @@ +module Day04 (main) where + +main :: IO () +main = do + input <- readFile "input/04.txt" + print input \ No newline at end of file diff --git a/src/Day05.hs b/src/Day05.hs new file mode 100644 index 0000000..b417bc0 --- /dev/null +++ b/src/Day05.hs @@ -0,0 +1,6 @@ +module Day05 (main) where + +main :: IO () +main = do + input <- readFile "input/05.txt" + print input \ No newline at end of file diff --git a/src/Day06.hs b/src/Day06.hs new file mode 100644 index 0000000..f145ccb --- /dev/null +++ b/src/Day06.hs @@ -0,0 +1,6 @@ +module Day06 (main) where + +main :: IO () +main = do + input <- readFile "input/06.txt" + print input \ No newline at end of file diff --git a/src/Day07.hs b/src/Day07.hs new file mode 100644 index 0000000..be411b9 --- /dev/null +++ b/src/Day07.hs @@ -0,0 +1,6 @@ +module Day07 (main) where + +main :: IO () +main = do + input <- readFile "input/07.txt" + print input \ No newline at end of file diff --git a/src/Day08.hs b/src/Day08.hs new file mode 100644 index 0000000..bc9473e --- /dev/null +++ b/src/Day08.hs @@ -0,0 +1,6 @@ +module Day08 (main) where + +main :: IO () +main = do + input <- readFile "input/08.txt" + print input \ No newline at end of file diff --git a/src/Day09.hs b/src/Day09.hs new file mode 100644 index 0000000..c218e82 --- /dev/null +++ b/src/Day09.hs @@ -0,0 +1,6 @@ +module Day09 (main) where + +main :: IO () +main = do + input <- readFile "input/09.txt" + print input \ No newline at end of file diff --git a/src/Day10.hs b/src/Day10.hs new file mode 100644 index 0000000..6eb3e43 --- /dev/null +++ b/src/Day10.hs @@ -0,0 +1,6 @@ +module Day10 (main) where + +main :: IO () +main = do + input <- readFile "input/10.txt" + print input \ No newline at end of file diff --git a/src/Day11.hs b/src/Day11.hs new file mode 100644 index 0000000..863d28f --- /dev/null +++ b/src/Day11.hs @@ -0,0 +1,6 @@ +module Day11 (main) where + +main :: IO () +main = do + input <- readFile "input/11.txt" + print input \ No newline at end of file diff --git a/src/Day12.hs b/src/Day12.hs new file mode 100644 index 0000000..f1cfc5e --- /dev/null +++ b/src/Day12.hs @@ -0,0 +1,6 @@ +module Day12 (main) where + +main :: IO () +main = do + input <- readFile "input/12.txt" + print input \ No newline at end of file diff --git a/src/Day13.hs b/src/Day13.hs new file mode 100644 index 0000000..07d7e60 --- /dev/null +++ b/src/Day13.hs @@ -0,0 +1,6 @@ +module Day13 (main) where + +main :: IO () +main = do + input <- readFile "input/13.txt" + print input \ No newline at end of file diff --git a/src/Day14.hs b/src/Day14.hs new file mode 100644 index 0000000..9457e44 --- /dev/null +++ b/src/Day14.hs @@ -0,0 +1,6 @@ +module Day14 (main) where + +main :: IO () +main = do + input <- readFile "input/14.txt" + print input \ No newline at end of file diff --git a/src/Day15.hs b/src/Day15.hs new file mode 100644 index 0000000..cb8cde7 --- /dev/null +++ b/src/Day15.hs @@ -0,0 +1,6 @@ +module Day15 (main) where + +main :: IO () +main = do + input <- readFile "input/15.txt" + print input \ No newline at end of file diff --git a/src/Day16.hs b/src/Day16.hs new file mode 100644 index 0000000..b095e5d --- /dev/null +++ b/src/Day16.hs @@ -0,0 +1,6 @@ +module Day16 (main) where + +main :: IO () +main = do + input <- readFile "input/16.txt" + print input \ No newline at end of file diff --git a/src/Day17.hs b/src/Day17.hs new file mode 100644 index 0000000..f466a1b --- /dev/null +++ b/src/Day17.hs @@ -0,0 +1,6 @@ +module Day17 (main) where + +main :: IO () +main = do + input <- readFile "input/17.txt" + print input \ No newline at end of file diff --git a/src/Day18.hs b/src/Day18.hs new file mode 100644 index 0000000..1c0fde9 --- /dev/null +++ b/src/Day18.hs @@ -0,0 +1,6 @@ +module Day18 (main) where + +main :: IO () +main = do + input <- readFile "input/18.txt" + print input \ No newline at end of file diff --git a/src/Day19.hs b/src/Day19.hs new file mode 100644 index 0000000..1430c4c --- /dev/null +++ b/src/Day19.hs @@ -0,0 +1,6 @@ +module Day19 (main) where + +main :: IO () +main = do + input <- readFile "input/19.txt" + print input \ No newline at end of file diff --git a/src/Day20.hs b/src/Day20.hs new file mode 100644 index 0000000..ab47399 --- /dev/null +++ b/src/Day20.hs @@ -0,0 +1,6 @@ +module Day20 (main) where + +main :: IO () +main = do + input <- readFile "input/20.txt" + print input \ No newline at end of file diff --git a/src/Day21.hs b/src/Day21.hs new file mode 100644 index 0000000..d7a8630 --- /dev/null +++ b/src/Day21.hs @@ -0,0 +1,6 @@ +module Day21 (main) where + +main :: IO () +main = do + input <- readFile "input/21.txt" + print input \ No newline at end of file diff --git a/src/Day22.hs b/src/Day22.hs new file mode 100644 index 0000000..eaf35f0 --- /dev/null +++ b/src/Day22.hs @@ -0,0 +1,6 @@ +module Day22 (main) where + +main :: IO () +main = do + input <- readFile "input/22.txt" + print input \ No newline at end of file diff --git a/src/Day23.hs b/src/Day23.hs new file mode 100644 index 0000000..6ef9dd8 --- /dev/null +++ b/src/Day23.hs @@ -0,0 +1,6 @@ +module Day23 (main) where + +main :: IO () +main = do + input <- readFile "input/23.txt" + print input \ No newline at end of file diff --git a/src/Day24.hs b/src/Day24.hs new file mode 100644 index 0000000..2ffd581 --- /dev/null +++ b/src/Day24.hs @@ -0,0 +1,6 @@ +module Day24 (main) where + +main :: IO () +main = do + input <- readFile "input/24.txt" + print input \ No newline at end of file diff --git a/src/Day25.hs b/src/Day25.hs new file mode 100644 index 0000000..42585a2 --- /dev/null +++ b/src/Day25.hs @@ -0,0 +1,6 @@ +module Day25 (main) where + +main :: IO () +main = do + input <- readFile "input/25.txt" + print input \ No newline at end of file diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..c59e61f --- /dev/null +++ b/stack.yaml @@ -0,0 +1,65 @@ +# This file was automatically generated by 'stack init' +# +# Some commonly used options have been documented as comments in this file. +# For advanced use and comprehensive documentation of the format, please see: +# https://docs.haskellstack.org/en/stable/yaml_configuration/ + +# Resolver to choose a 'specific' stackage snapshot or a compiler version. +# A snapshot resolver dictates the compiler version and the set of packages +# to be used for project dependencies. For example: +# +# resolver: lts-3.5 +# resolver: nightly-2015-09-21 +# resolver: ghc-7.10.2 +# resolver: ghcjs-0.1.0_ghc-7.10.2 +# +# The location of a snapshot can be provided as a file or url. Stack assumes +# a snapshot provided as a file might change, whereas a url resource does not. +# +# resolver: ./custom-snapshot.yaml +# resolver: https://example.com/snapshots/2018-01-01.yaml +resolver: lts-12.19 + +# User packages to be built. +# Various formats can be used as shown in the example below. +# +# packages: +# - some-directory +# - https://example.com/foo/bar/baz-0.0.2.tar.gz +# - location: +# git: https://github.com/commercialhaskell/stack.git +# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a +# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a +# subdirs: +# - auto-update +# - wai +packages: +- . +# Dependency packages to be pulled from upstream that are not in the resolver +# using the same syntax as the packages field. +# (e.g., acme-missiles-0.3) +# extra-deps: [] + +# Override default flag values for local packages and extra-deps +# flags: {} + +# Extra package databases containing global packages +# extra-package-dbs: [] + +# Control whether we use the GHC we find on the path +# system-ghc: true +# +# Require a specific version of stack, using version ranges +# require-stack-version: -any # Default +# require-stack-version: ">=1.7" +# +# Override the architecture used by stack, especially useful on Windows +# arch: i386 +# arch: x86_64 +# +# Extra directories used by stack for building +# extra-include-dirs: [/path/to/dir] +# extra-lib-dirs: [/path/to/dir] +# +# Allow a newer minor version of GHC than the snapshot specifies +# compiler-check: newer-minor \ No newline at end of file