Initial commit

This commit is contained in:
Andrew R. M 2022-12-06 16:09:51 -05:00
commit b53a8a48ee
32 changed files with 7450 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.stack-work/
*~

11
CHANGELOG.md Normal file
View File

@ -0,0 +1,11 @@
# Changelog for `aoc2022`
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the
[Haskell Package Versioning Policy](https://pvp.haskell.org/).
## Unreleased
## 0.1.0.0 - YYYY-MM-DD

30
LICENSE Normal file
View File

@ -0,0 +1,30 @@
Copyright Author name here (c) 2022
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 Author name here 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.

1
README.md Normal file
View File

@ -0,0 +1 @@
# aoc2022

2
Setup.hs Normal file
View File

@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain

166
aoc2022.cabal Normal file
View File

@ -0,0 +1,166 @@
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.35.0.
--
-- see: https://github.com/sol/hpack
name: aoc2022
version: 0.1.0.0
description: Please see the README on GitHub at <https://github.com/githubuser/aoc2022#readme>
homepage: https://github.com/githubuser/aoc2022#readme
bug-reports: https://github.com/githubuser/aoc2022/issues
author: Author name here
maintainer: example@example.com
copyright: 2022 Author name here
license: BSD3
license-file: LICENSE
build-type: Simple
extra-source-files:
README.md
CHANGELOG.md
source-repository head
type: git
location: https://github.com/githubuser/aoc2022
library
exposed-modules:
Day1Lib
Day2Lib
Day3Lib
Day4Lib
Day5Lib
other-modules:
Paths_aoc2022
hs-source-dirs:
src
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints
build-depends:
base >=4.7 && <5
, split
default-language: Haskell2010
executable Day1Part1
main-is: Day1Part1.hs
hs-source-dirs:
day1
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day1Part1
build-depends:
aoc2022
, base >=4.7 && <5
, split
default-language: Haskell2010
executable Day1Part2
main-is: Day1Part2.hs
hs-source-dirs:
day1
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day1Part2
build-depends:
aoc2022
, base >=4.7 && <5
, split
default-language: Haskell2010
executable Day2Part1
main-is: Day2Part1.hs
hs-source-dirs:
day2
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day2Part1
build-depends:
aoc2022
, base >=4.7 && <5
, split
default-language: Haskell2010
executable Day2Part2
main-is: Day2Part2.hs
hs-source-dirs:
day2
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day2Part2
build-depends:
aoc2022
, base >=4.7 && <5
, split
default-language: Haskell2010
executable Day3Part1
main-is: Day3Part1.hs
hs-source-dirs:
day3
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day3Part1
build-depends:
aoc2022
, base >=4.7 && <5
, split
default-language: Haskell2010
executable Day3Part2
main-is: Day3Part2.hs
hs-source-dirs:
day3
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day3Part2
build-depends:
aoc2022
, base >=4.7 && <5
, split
default-language: Haskell2010
executable Day4Part1
main-is: Day4Part1.hs
hs-source-dirs:
day4
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day4Part1
build-depends:
aoc2022
, base >=4.7 && <5
, split
default-language: Haskell2010
executable Day4Part2
main-is: Day4Part2.hs
hs-source-dirs:
day4
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day4Part2
build-depends:
aoc2022
, base >=4.7 && <5
, split
default-language: Haskell2010
executable Day5Part1
main-is: Day5Part1.hs
hs-source-dirs:
day5
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day5Part1
build-depends:
aoc2022
, base >=4.7 && <5
, split
default-language: Haskell2010
executable Day5Part2
main-is: Day5Part2.hs
hs-source-dirs:
day5
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day5Part2
build-depends:
aoc2022
, base >=4.7 && <5
, split
default-language: Haskell2010
test-suite Day1-test
type: exitcode-stdio-1.0
main-is: Day1.hs
other-modules:
Spec
Paths_aoc2022
hs-source-dirs:
test
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
build-depends:
aoc2022
, base >=4.7 && <5
, split
default-language: Haskell2010

6
app/Main.hs Normal file
View File

@ -0,0 +1,6 @@
module Main (main) where
import Lib
main :: IO ()
main = someFunc

9
day1/Day1Part1.hs Normal file
View File

@ -0,0 +1,9 @@
module Day1Part1 (main) where
import Day1Lib
main :: IO ()
main = do
input <- getContents
putStrLn $ convertToString $ day1 input

9
day1/Day1Part2.hs Normal file
View File

@ -0,0 +1,9 @@
module Day1Part2 (main) where
import Day1Lib
main :: IO ()
main = do
input <- getContents
putStrLn $ convertToString $ day1Two input

2243
day1/input Normal file

File diff suppressed because it is too large Load Diff

11
day2/Day2Part1.hs Normal file
View File

@ -0,0 +1,11 @@
module Day2Part1 (main) where
import Day2Lib
convertToString :: Int -> String
convertToString = show
main :: IO ()
main = do
input <- getContents
putStrLn $ convertToString $ day2 input

11
day2/Day2Part2.hs Normal file
View File

@ -0,0 +1,11 @@
module Day2Part2 (main) where
import Day2Lib
convertToString :: Int -> String
convertToString = show
main :: IO ()
main = do
input <- getContents
putStrLn $ convertToString $ day2Alternate input

2500
day2/input Normal file

File diff suppressed because it is too large Load Diff

11
day3/Day3Part1.hs Normal file
View File

@ -0,0 +1,11 @@
module Day3Part1 (main) where
import Day3Lib
convertToString :: Int -> String
convertToString = show
main :: IO ()
main = do
input <- getContents
putStrLn $ convertToString $ day3 input

11
day3/Day3Part2.hs Normal file
View File

@ -0,0 +1,11 @@
module Day3Part2 (main) where
import Day3Lib
convertToString :: Int -> String
convertToString = show
main :: IO ()
main = do
input <- getContents
putStrLn $ convertToString $ day3Alternate input

300
day3/input Normal file
View File

@ -0,0 +1,300 @@
DsPhSBQQQhqmBDhPDsFwjwsLjlRjlttvjvvtRb
rNJMNNbrHrtjHLHjvwtg
fNbNzZdrZnMnMPnQShFPDmnqFm
QWVCFfQffgQCVZzVVpHsHJBqtpspJFRHqq
mwDbmnnGNlNcwNDDNRbnNDlJTpBJBtJGtPTLsBGqTqqsqp
MlSdnScRnnmmDjSdNSdCzvggWzrgzjvfvrgVzW
gsMljbrjlZlWcWMJrWwTwbmwQbmmLDQQLhwL
CdgpzdgpgnfThHfFRwhfRf
SptgpSpnCNpVSGNPvPGSddcMWjMrjqBsJcWqMcBWcVlZ
JcJLQQFWhQJPJpWcwjHvMQvnnlMvzBHd
tCtGZrmVRmVGTVTtCfRTCHHNNvdNzmdMvMlNzvwdvw
CTGGRftfSGtGTGDLbFchSgSWWWcM
QcMFQrvrQbvtczbVbjbMzZzRpqmDDmqqnNzCDCDC
SHHfPJssGLPSdHThLhHdRmqNmNssnNmNCNnpjmsn
LhLJfTdLJwfgPTdfGccrtjcMrccwvcrrFr
jFLLLqDGjbtqLCChp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CVLtSLCc
dGzdQMFzQMdgGGlGJMzBgBwRqNNfmmTsvfRfJTpwjmpP
pcphpdrWDmTgHWMtRWqHRVVH
SbGcGGQnvNQGvsjBtVHBLjvqVPVB
lzbQCzbZllSzQslpCJpJJDggcggfDT
ffrTlhrVrfCsDVTsWzGBBZcBRBqRBWtGtZcq
QNFmFHrHNSSmSLJdJrNGZLbGjbcBjBGjqcbgjc
ddQvPnHddnQJHSHSFPdnFfDDTfDMMCrwMlPTwDCsrC
NBnrNHQHBscvhfBM
bbGtgWWWqZFmnZGZbmVCdMzvvShfzfGcdcfMSS
WqbjnmbnjWgmFFgtWVbWZwNTNLjNprNwQLDwrTrHQr
lwwlcjlzQRBcBccbdLCVnNVWJJzfLndd
pZDMtZpSDMZpMZMsPtHVNJVfRCRddVndnJLSJd
mDTZvTqtDDHttRPcqhQlwgGlghbqBh
DTspTqssqTbdmCMwVmnmlfCD
PLPWjjrSjvPzqZvjvRqjLtPwnnHCmWVcncMnnwmncHcHll
RFztFjjqjQFQTbdTbQ
hTFSVSdhMMVMFjjgbthcbzczcg
DvwCJVJWWJDRnfmbDmccfmmgfb
QrJvPGWWnpVMqdZsZpqM
gRLcHbgnfpgpJjlqqp
SFwrTHFBqlZtBPZq
HTzDwmSvCvCmsmmvTSwvFwcfRRNRLcQRWNssNNbRWLWL
PpMgDMDnsWSnjBQnrjbn
LFcVVGChCFdhdVFZVpVCdVbvQbRrbvBBbBjQSJZrrJrR
FNwGNCCFHcVTHcFdHHHTDzMzfsgzwpPWMmPflmtt

11
day4/Day4Part1.hs Normal file
View File

@ -0,0 +1,11 @@
module Day4Part1 (main) where
import Day4Lib
convertToString :: Int -> String
convertToString = show
main :: IO ()
main = do
input <- getContents
putStrLn $ convertToString $ day4 input

11
day4/Day4Part2.hs Normal file
View File

@ -0,0 +1,11 @@
module Day4Part2 (main) where
import Day4Lib
convertToString :: Int -> String
convertToString = show
main :: IO ()
main = do
input <- getContents
putStrLn $ convertToString $ day4Alternate input

1000
day4/input Normal file

File diff suppressed because it is too large Load Diff

11
day5/Day5Part1.hs Normal file
View File

@ -0,0 +1,11 @@
module Day5Part1 (main) where
import Day5Lib
convertToString :: Int -> String
convertToString = show
main :: IO ()
main = do
input <- getContents
putStrLn $ day5 input

11
day5/Day5Part2.hs Normal file
View File

@ -0,0 +1,11 @@
module Day5Part2 (main) where
import Day5Lib
convertToString :: Int -> String
convertToString = show
main :: IO ()
main = do
input <- getContents
putStrLn $ "'" ++ day5Alternate input ++ "'"

512
day5/input Normal file
View File

@ -0,0 +1,512 @@
[V] [C] [M]
[V] [J] [N] [H] [V]
[R] [F] [N] [W] [Z] [N]
[H] [R] [D] [Q] [M] [L] [B]
[B] [C] [H] [V] [R] [C] [G] [R]
[G] [G] [F] [S] [D] [H] [B] [R] [S]
[D] [N] [S] [D] [H] [G] [J] [J] [G]
[W] [J] [L] [J] [S] [P] [F] [S] [L]
1 2 3 4 5 6 7 8 9
move 2 from 2 to 7
move 8 from 5 to 6
move 2 from 4 to 5
move 1 from 4 to 5
move 1 from 5 to 8
move 5 from 9 to 2
move 7 from 1 to 6
move 7 from 3 to 8
move 1 from 4 to 6
move 2 from 5 to 6
move 6 from 7 to 5
move 2 from 2 to 4
move 4 from 5 to 2
move 10 from 8 to 1
move 2 from 7 to 4
move 4 from 2 to 8
move 2 from 9 to 8
move 1 from 8 to 4
move 2 from 4 to 9
move 5 from 8 to 2
move 1 from 4 to 6
move 1 from 8 to 9
move 1 from 7 to 2
move 2 from 4 to 2
move 1 from 7 to 3
move 13 from 2 to 1
move 1 from 2 to 4
move 1 from 2 to 3
move 2 from 5 to 4
move 17 from 6 to 4
move 3 from 4 to 9
move 14 from 1 to 4
move 4 from 6 to 8
move 1 from 9 to 8
move 23 from 4 to 8
move 6 from 1 to 7
move 3 from 1 to 5
move 1 from 3 to 8
move 5 from 7 to 8
move 1 from 3 to 4
move 1 from 5 to 3
move 1 from 5 to 1
move 1 from 3 to 2
move 1 from 9 to 4
move 9 from 4 to 9
move 1 from 1 to 2
move 11 from 8 to 2
move 1 from 4 to 5
move 13 from 2 to 3
move 7 from 9 to 6
move 1 from 5 to 6
move 1 from 5 to 2
move 1 from 9 to 4
move 1 from 4 to 9
move 2 from 8 to 9
move 1 from 7 to 8
move 8 from 9 to 1
move 8 from 1 to 4
move 4 from 6 to 7
move 1 from 9 to 4
move 2 from 3 to 9
move 1 from 9 to 1
move 6 from 4 to 1
move 2 from 1 to 3
move 22 from 8 to 6
move 1 from 2 to 5
move 3 from 7 to 8
move 15 from 6 to 4
move 7 from 3 to 7
move 4 from 6 to 9
move 2 from 9 to 2
move 6 from 3 to 5
move 3 from 9 to 5
move 5 from 5 to 8
move 1 from 2 to 1
move 6 from 8 to 2
move 1 from 1 to 2
move 3 from 5 to 3
move 1 from 7 to 2
move 4 from 7 to 8
move 4 from 6 to 1
move 1 from 5 to 1
move 4 from 8 to 7
move 2 from 3 to 2
move 1 from 1 to 3
move 15 from 4 to 2
move 3 from 7 to 3
move 4 from 7 to 2
move 1 from 4 to 9
move 5 from 3 to 8
move 29 from 2 to 1
move 1 from 9 to 5
move 1 from 2 to 1
move 11 from 1 to 5
move 1 from 4 to 5
move 2 from 6 to 3
move 1 from 3 to 4
move 16 from 1 to 9
move 4 from 8 to 4
move 3 from 6 to 9
move 1 from 3 to 7
move 1 from 7 to 3
move 6 from 1 to 6
move 3 from 4 to 3
move 3 from 8 to 5
move 3 from 1 to 8
move 3 from 1 to 4
move 2 from 4 to 9
move 3 from 6 to 3
move 15 from 5 to 2
move 3 from 2 to 3
move 4 from 2 to 7
move 2 from 5 to 9
move 10 from 3 to 6
move 11 from 9 to 5
move 2 from 4 to 9
move 8 from 9 to 4
move 1 from 9 to 6
move 7 from 4 to 6
move 3 from 5 to 8
move 22 from 6 to 9
move 4 from 7 to 8
move 8 from 5 to 8
move 2 from 4 to 3
move 1 from 8 to 1
move 17 from 8 to 3
move 3 from 3 to 4
move 13 from 3 to 9
move 20 from 9 to 7
move 2 from 2 to 9
move 19 from 9 to 5
move 1 from 1 to 4
move 3 from 2 to 7
move 4 from 4 to 3
move 1 from 9 to 8
move 18 from 5 to 1
move 1 from 9 to 4
move 1 from 9 to 7
move 2 from 4 to 8
move 1 from 5 to 4
move 3 from 2 to 7
move 3 from 3 to 1
move 2 from 1 to 3
move 3 from 3 to 8
move 1 from 4 to 8
move 6 from 8 to 2
move 1 from 3 to 9
move 1 from 3 to 9
move 10 from 1 to 9
move 7 from 1 to 7
move 4 from 7 to 4
move 29 from 7 to 3
move 6 from 2 to 9
move 25 from 3 to 6
move 5 from 3 to 9
move 13 from 6 to 9
move 12 from 6 to 2
move 1 from 8 to 9
move 10 from 2 to 6
move 7 from 6 to 5
move 20 from 9 to 3
move 11 from 3 to 6
move 1 from 7 to 9
move 2 from 2 to 9
move 19 from 9 to 2
move 14 from 6 to 8
move 4 from 5 to 2
move 2 from 4 to 6
move 3 from 5 to 1
move 13 from 8 to 5
move 1 from 6 to 1
move 2 from 4 to 2
move 8 from 2 to 4
move 6 from 4 to 7
move 1 from 9 to 8
move 2 from 4 to 7
move 5 from 2 to 4
move 4 from 4 to 2
move 10 from 5 to 6
move 1 from 1 to 7
move 1 from 5 to 4
move 1 from 4 to 9
move 4 from 7 to 8
move 5 from 1 to 7
move 1 from 9 to 7
move 7 from 3 to 2
move 2 from 5 to 2
move 8 from 6 to 9
move 1 from 4 to 6
move 3 from 7 to 4
move 5 from 9 to 7
move 2 from 4 to 3
move 20 from 2 to 4
move 2 from 4 to 8
move 14 from 4 to 2
move 12 from 7 to 4
move 8 from 2 to 1
move 10 from 2 to 4
move 6 from 8 to 5
move 1 from 7 to 8
move 4 from 4 to 3
move 1 from 3 to 9
move 1 from 2 to 7
move 1 from 6 to 8
move 5 from 3 to 5
move 1 from 3 to 2
move 7 from 4 to 5
move 6 from 1 to 7
move 5 from 7 to 6
move 1 from 6 to 5
move 2 from 7 to 8
move 1 from 2 to 6
move 2 from 8 to 2
move 5 from 5 to 7
move 6 from 6 to 8
move 16 from 4 to 9
move 16 from 9 to 4
move 11 from 5 to 4
move 5 from 8 to 3
move 2 from 5 to 2
move 14 from 4 to 2
move 1 from 6 to 3
move 1 from 6 to 9
move 1 from 5 to 3
move 3 from 8 to 2
move 10 from 4 to 7
move 5 from 9 to 2
move 3 from 4 to 7
move 1 from 1 to 4
move 3 from 2 to 5
move 2 from 3 to 7
move 1 from 4 to 2
move 18 from 2 to 8
move 3 from 8 to 4
move 5 from 3 to 1
move 1 from 3 to 9
move 1 from 9 to 3
move 8 from 8 to 7
move 2 from 5 to 4
move 1 from 5 to 6
move 1 from 2 to 5
move 1 from 5 to 8
move 1 from 6 to 9
move 3 from 2 to 7
move 27 from 7 to 4
move 2 from 2 to 4
move 4 from 8 to 4
move 1 from 9 to 8
move 3 from 1 to 6
move 1 from 3 to 5
move 3 from 8 to 3
move 1 from 1 to 4
move 1 from 8 to 1
move 3 from 1 to 4
move 2 from 8 to 2
move 2 from 6 to 2
move 8 from 4 to 9
move 1 from 7 to 1
move 1 from 5 to 4
move 1 from 7 to 3
move 4 from 2 to 7
move 1 from 8 to 6
move 8 from 9 to 7
move 1 from 6 to 3
move 3 from 3 to 4
move 37 from 4 to 1
move 1 from 4 to 5
move 13 from 7 to 8
move 6 from 8 to 4
move 5 from 8 to 3
move 1 from 7 to 6
move 4 from 1 to 5
move 1 from 6 to 5
move 2 from 8 to 4
move 32 from 1 to 5
move 1 from 1 to 4
move 5 from 3 to 5
move 1 from 3 to 2
move 1 from 2 to 9
move 19 from 5 to 2
move 1 from 9 to 1
move 16 from 5 to 1
move 7 from 5 to 6
move 1 from 3 to 1
move 11 from 1 to 2
move 18 from 2 to 4
move 1 from 5 to 9
move 8 from 6 to 1
move 10 from 2 to 6
move 7 from 4 to 9
move 2 from 2 to 1
move 7 from 4 to 2
move 5 from 4 to 5
move 2 from 9 to 6
move 9 from 6 to 3
move 5 from 5 to 3
move 8 from 4 to 9
move 7 from 9 to 8
move 4 from 2 to 9
move 10 from 3 to 1
move 6 from 8 to 1
move 2 from 6 to 3
move 5 from 3 to 8
move 3 from 2 to 7
move 1 from 9 to 5
move 1 from 3 to 5
move 2 from 7 to 8
move 1 from 8 to 9
move 1 from 6 to 1
move 23 from 1 to 4
move 2 from 5 to 3
move 1 from 8 to 2
move 2 from 8 to 5
move 2 from 5 to 6
move 1 from 2 to 7
move 1 from 7 to 5
move 4 from 9 to 7
move 1 from 7 to 5
move 1 from 3 to 6
move 3 from 7 to 4
move 1 from 3 to 8
move 1 from 4 to 6
move 6 from 1 to 8
move 4 from 6 to 4
move 2 from 9 to 1
move 1 from 5 to 1
move 19 from 4 to 2
move 2 from 9 to 3
move 1 from 9 to 3
move 9 from 1 to 8
move 1 from 5 to 8
move 1 from 9 to 3
move 2 from 3 to 9
move 3 from 8 to 4
move 1 from 4 to 9
move 1 from 9 to 5
move 2 from 3 to 4
move 6 from 4 to 7
move 3 from 9 to 5
move 4 from 4 to 7
move 1 from 5 to 6
move 18 from 2 to 7
move 13 from 7 to 9
move 3 from 5 to 1
move 1 from 2 to 1
move 1 from 6 to 5
move 3 from 1 to 7
move 1 from 1 to 5
move 7 from 9 to 6
move 8 from 7 to 4
move 11 from 7 to 6
move 5 from 9 to 2
move 17 from 6 to 1
move 2 from 5 to 1
move 11 from 8 to 1
move 20 from 1 to 2
move 3 from 8 to 1
move 1 from 9 to 8
move 1 from 6 to 1
move 11 from 1 to 7
move 18 from 2 to 3
move 12 from 4 to 8
move 11 from 7 to 3
move 7 from 2 to 3
move 2 from 1 to 5
move 1 from 1 to 3
move 1 from 8 to 1
move 1 from 5 to 9
move 1 from 9 to 6
move 1 from 8 to 7
move 1 from 5 to 3
move 1 from 6 to 7
move 2 from 8 to 1
move 8 from 3 to 2
move 7 from 2 to 9
move 6 from 8 to 6
move 1 from 9 to 3
move 2 from 6 to 4
move 5 from 9 to 6
move 7 from 6 to 2
move 8 from 2 to 9
move 2 from 1 to 9
move 2 from 7 to 2
move 2 from 4 to 8
move 1 from 2 to 7
move 25 from 3 to 7
move 7 from 9 to 7
move 1 from 2 to 5
move 1 from 1 to 4
move 3 from 8 to 1
move 3 from 1 to 8
move 3 from 7 to 8
move 15 from 7 to 3
move 10 from 8 to 3
move 1 from 5 to 7
move 1 from 8 to 5
move 3 from 9 to 2
move 1 from 6 to 4
move 2 from 2 to 7
move 1 from 2 to 5
move 14 from 7 to 9
move 1 from 6 to 2
move 1 from 7 to 1
move 1 from 5 to 4
move 3 from 4 to 3
move 1 from 7 to 6
move 1 from 2 to 7
move 1 from 1 to 2
move 3 from 9 to 1
move 1 from 6 to 2
move 2 from 2 to 6
move 17 from 3 to 6
move 1 from 8 to 3
move 1 from 5 to 4
move 2 from 7 to 2
move 9 from 9 to 8
move 1 from 9 to 3
move 16 from 3 to 2
move 1 from 7 to 5
move 5 from 6 to 5
move 1 from 1 to 6
move 1 from 4 to 1
move 1 from 9 to 3
move 9 from 8 to 6
move 3 from 1 to 5
move 1 from 9 to 1
move 16 from 2 to 1
move 2 from 2 to 7
move 2 from 3 to 9
move 2 from 7 to 4
move 2 from 9 to 3
move 3 from 3 to 5
move 1 from 4 to 5
move 1 from 4 to 2
move 1 from 1 to 7
move 1 from 7 to 1
move 1 from 3 to 6
move 2 from 5 to 1
move 3 from 6 to 2
move 2 from 5 to 8
move 8 from 5 to 4
move 1 from 5 to 3
move 1 from 3 to 2
move 1 from 8 to 3
move 1 from 3 to 8
move 4 from 1 to 7
move 9 from 1 to 7
move 6 from 1 to 8
move 3 from 7 to 4
move 7 from 6 to 7
move 11 from 4 to 3
move 2 from 3 to 8
move 8 from 3 to 8
move 4 from 6 to 1
move 1 from 7 to 4
move 2 from 1 to 2
move 8 from 7 to 2
move 1 from 4 to 8
move 10 from 8 to 2
move 2 from 6 to 1
move 1 from 1 to 4
move 1 from 4 to 8
move 2 from 1 to 4
move 6 from 6 to 5
move 1 from 1 to 9
move 2 from 6 to 8
move 1 from 4 to 5
move 1 from 6 to 9
move 4 from 8 to 9
move 1 from 7 to 1
move 6 from 8 to 6
move 1 from 6 to 1
move 1 from 4 to 9
move 2 from 9 to 5
move 5 from 5 to 9
move 8 from 9 to 5
move 2 from 8 to 5
move 3 from 6 to 9
move 8 from 5 to 7
move 5 from 5 to 6
move 1 from 9 to 2
move 1 from 3 to 1
move 1 from 6 to 7
move 1 from 5 to 6
move 24 from 2 to 4
move 3 from 9 to 7
move 16 from 4 to 5
move 2 from 1 to 3
move 12 from 5 to 6
move 1 from 9 to 5
move 4 from 5 to 9
move 1 from 1 to 6
move 1 from 5 to 2
move 2 from 9 to 8
move 1 from 8 to 1
move 5 from 4 to 5
move 2 from 3 to 5
move 1 from 8 to 3
move 1 from 1 to 6
move 3 from 5 to 7
move 1 from 9 to 1
move 1 from 2 to 8

9
example.txt Normal file
View File

@ -0,0 +1,9 @@
[D]
[N] [C]
[Z] [M] [P]
1 2 3
move 1 from 2 to 1
move 3 from 1 to 3
move 2 from 2 to 1
move 1 from 1 to 2

170
package.yaml Normal file
View File

@ -0,0 +1,170 @@
name: aoc2022
version: 0.1.0.0
github: "githubuser/aoc2022"
license: BSD3
author: "Author name here"
maintainer: "example@example.com"
copyright: "2022 Author name here"
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 <https://github.com/githubuser/aoc2022#readme>
dependencies:
- base >= 4.7 && < 5
- split
ghc-options:
- -Wall
- -Wcompat
- -Widentities
- -Wincomplete-record-updates
- -Wincomplete-uni-patterns
- -Wmissing-export-lists
- -Wmissing-home-modules
- -Wpartial-fields
- -Wredundant-constraints
library:
source-dirs: src
executables:
Day1Part1:
main: Day1Part1.hs
other-modules: []
source-dirs: day1
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -main-is Day1Part1
dependencies:
- aoc2022
Day1Part2:
main: Day1Part2.hs
other-modules: []
source-dirs: day1
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -main-is Day1Part2
dependencies:
- aoc2022
Day2Part1:
main: Day2Part1.hs
other-modules: []
source-dirs: day2
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -main-is Day2Part1
dependencies:
- aoc2022
Day2Part2:
main: Day2Part2.hs
other-modules: []
source-dirs: day2
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -main-is Day2Part2
dependencies:
- aoc2022
Day3Part1:
main: Day3Part1.hs
other-modules: []
source-dirs: day3
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -main-is Day3Part1
dependencies:
- aoc2022
Day3Part2:
main: Day3Part2.hs
other-modules: []
source-dirs: day3
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -main-is Day3Part2
dependencies:
- aoc2022
Day4Part1:
main: Day4Part1.hs
other-modules: []
source-dirs: day4
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -main-is Day4Part1
dependencies:
- aoc2022
Day4Part2:
main: Day4Part2.hs
other-modules: []
source-dirs: day4
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -main-is Day4Part2
dependencies:
- aoc2022
Day5Part1:
main: Day5Part1.hs
other-modules: []
source-dirs: day5
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -main-is Day5Part1
dependencies:
- aoc2022
Day5Part2:
main: Day5Part2.hs
other-modules: []
source-dirs: day5
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -main-is Day5Part2
dependencies:
- aoc2022
tests:
Day1-test:
main: Day1.hs
source-dirs: test
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- aoc2022

28
src/Day1Lib.hs Normal file
View File

@ -0,0 +1,28 @@
module Day1Lib
( day1,
day1Two,
convertToString
) where
import Data.List
import Data.List.Split
convertToInt :: [String] -> [Int]
convertToInt = map read
convertToString :: Int -> String
convertToString = show
day1 :: String -> Int
day1 input = foldl max 0 summedList
where
summedList = map sum splitInputAsInt
splitInputAsInt = map (map read) splitInput :: [[Int]]
splitInput = map words $ splitOn "\n\n" input
day1Two :: String -> Int
day1Two input = sum $ take 3 $ reverse $ sort summedList
where
summedList = map sum splitInputAsInt
splitInputAsInt = map (map read) splitInput :: [[Int]]
splitInput = map words $ splitOn "\n\n" input

81
src/Day2Lib.hs Normal file
View File

@ -0,0 +1,81 @@
module Day2Lib
( day2,
day2Alternate
) where
import Data.List.Split
data RPSMove = Rock | Paper | Scissors deriving Eq
data WinState = Lose | Draw | Win
type RoundResult = (RPSMove, WinState)
scoreMove :: RPSMove -> Int
scoreMove Rock = 1
scoreMove Paper = 2
scoreMove Scissors = 3
scoreWinState :: WinState -> Int
scoreWinState Lose = 0
scoreWinState Draw = 3
scoreWinState Win = 6
scoreRound :: RoundResult -> Int
scoreRound (move, winstate) = scoreMove move + scoreWinState winstate
playRound :: (RPSMove, RPSMove) -> RoundResult
playRound (theirMove, myMove)
| theirMove == myMove = (myMove, Draw)
| theirMove == Paper && myMove == Scissors = (myMove, Win)
| theirMove == Rock && myMove == Paper = (myMove, Win)
| theirMove == Scissors && myMove == Rock = (myMove, Win)
| otherwise = (myMove, Lose)
winRound :: (RPSMove, WinState) -> RoundResult
winRound (theirMove, Win)
| theirMove == Rock = (Paper, Win)
| theirMove == Paper = (Scissors, Win)
| theirMove == Scissors = (Rock, Win)
winRound (theirMove, Lose)
| theirMove == Rock = (Scissors, Lose)
| theirMove == Paper = (Rock, Lose)
| theirMove == Scissors = (Paper, Lose)
winRound (theirMove, Draw) = (theirMove, Draw)
parseMoves :: (String, String) -> (RPSMove, RPSMove)
parseMoves (a, x) = (parseTheirMove a, parseMyMove x)
parseTheirMove :: String -> RPSMove
parseTheirMove a
| a == "A" = Rock
| a == "B" = Paper
| a == "C" = Scissors
parseMyMove :: String -> RPSMove
parseMyMove x
| x == "X" = Rock
| x == "Y" = Paper
| x == "Z" = Scissors
parseMoveAndDesiredWinState :: (String, String) -> (RPSMove, WinState)
parseMoveAndDesiredWinState (a, x) = (parseTheirMove a, parseMyDesiredWinState x)
parseMyDesiredWinState :: String -> WinState
parseMyDesiredWinState x
| x == "X" = Lose
| x == "Y" = Draw
| x == "Z" = Win
tuplify2 :: [a] -> (a,a)
tuplify2 [x,y] = (x,y)
parseInput :: String -> [(RPSMove, RPSMove)]
parseInput i = map (parseMoves) $ map tuplify2 $ map (splitOn " ") $ lines i
parseInputAlternate :: String -> [(RPSMove, WinState)]
parseInputAlternate i = map (parseMoveAndDesiredWinState) $ map tuplify2 $ map (splitOn " ") $ lines i
day2 :: String -> Int
day2 input = sum $ map scoreRound $ map playRound $ parseInput input
day2Alternate :: String -> Int
day2Alternate input = sum $ map scoreRound $ map winRound $ parseInputAlternate input

48
src/Day3Lib.hs Normal file
View File

@ -0,0 +1,48 @@
module Day3Lib
( day3,
day3Alternate
) where
import Data.List (elemIndex, intersect, nub)
import Data.Maybe
type RucksackItems = [Char]
type RucksackItem = Char
type ElfGroup = (RucksackItems, RucksackItems, RucksackItems)
priority :: RucksackItem -> Int
priority i
| i `elem` lowercases = (fromJust $ elemIndex i lowercases) + 1
| i `elem` uppercases = (fromJust $ elemIndex i uppercases) + 27
| otherwise = 0
where
lowercases = "abcdefghijklmnopqrstuvwxyz"
uppercases = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
intersectingItems :: (RucksackItems, RucksackItems) -> RucksackItems
intersectingItems (r1, r2) = r1 `intersect` r2
parseLine :: String -> (RucksackItems, RucksackItems)
parseLine l = (take halfLength l, drop halfLength l)
where
halfLength = length l `div` 2
parseInput :: String -> [(RucksackItems, RucksackItems)]
parseInput i = map parseLine $ lines i
day3 :: String -> Int
day3 input = sum $ map priority $ concat $ map nub $ map intersectingItems $ parseInput input
parseInputAlternate :: String -> [ElfGroup]
parseInputAlternate i = breakIntoGroups $ lines i
breakIntoGroups :: [String] -> [ElfGroup]
breakIntoGroups [] = []
breakIntoGroups (a:b:c:rest) = (a, b, c) : breakIntoGroups rest
processCommonItems :: Eq a => ([a], [a], [a]) -> [a]
processCommonItems (a,b,c) = intersect c $ intersect a b
day3Alternate :: String -> Int
day3Alternate input = sum $ map priority $ concat $ map nub $ map processCommonItems $ parseInputAlternate input

45
src/Day4Lib.hs Normal file
View File

@ -0,0 +1,45 @@
module Day4Lib
( day4,
day4Alternate
) where
import Data.List (intersect, isSubsequenceOf)
import Data.List.Split (splitOn)
type SectionId = Int
type Range = (SectionId, SectionId)
type RangePair = (Range, Range)
checkRangePairForPartialOverlap :: RangePair -> Bool
checkRangePairForPartialOverlap (r1, r2) = intersection
where
processedR1 = processRange r1
processedR2 = processRange r2
-- Get the intersection, convert it into a bool based on if it's empty, then negate the bool
intersection = not $ null $ processedR1 `intersect` processedR2
checkRangePairForFullOverlap :: RangePair -> Bool
checkRangePairForFullOverlap (r1, r2) = processedR1 `isSubsequenceOf` processedR2 || processedR2 `isSubsequenceOf` processedR1
where
processedR1 = processRange r1
processedR2 = processRange r2
processRange :: Range -> [SectionId]
processRange (s, e) = [s..e]
tuplify2 :: [a] -> (a,a)
tuplify2 [x,y] = (x, y)
parseInput :: String -> [RangePair]
parseInput i = map tuplify2 $ map (map tuplify2) $ map (map (map readAsInt)) $ map (map splitOnDash) $ map splitOnComma $ lines i
where
inputAsLines = lines i
splitOnComma = splitOn ","
splitOnDash = splitOn "-"
readAsInt r = read r :: Int
day4 :: String -> Int
day4 input = sum $ map fromEnum $ map checkRangePairForFullOverlap $ parseInput input
day4Alternate :: String -> Int
day4Alternate input = sum $ map fromEnum $ map checkRangePairForPartialOverlap $ parseInput input

102
src/Day5Lib.hs Normal file
View File

@ -0,0 +1,102 @@
module Day5Lib where
import Data.List (transpose)
import Data.List.Split
import Data.Char (isAlpha, isDigit)
type Crate = Char
type CrateStack = [Char]
type Quantity = Int
type CrateStackId = Int
type Instruction = (Quantity, CrateStackId, CrateStackId)
type Problem = ([CrateStack], [Instruction])
applyInstruction :: [CrateStack] -> Instruction -> [CrateStack]
applyInstruction cs (0, csi1, csi2) = cs
applyInstruction cs (q, csi1, csi2) = applyInstruction finalList (q - 1, csi1, csi2)
where
prior1 = fst $ splitAt (csi1 - 1) cs
post1 = snd $ splitAt (csi1) cs
-- Decrement by one to account for zero indexing
newCsi1 = tail (cs !! (csi1 - 1))
movedCrate = head (cs !! (csi1 - 1))
removedList = prior1 ++ (newCsi1 : post1)
prior2 = fst $ splitAt (csi2 - 1) removedList
post2 = snd $ splitAt (csi2) removedList
newCsi2 = movedCrate : (cs !! (csi2 - 1))
finalList = prior2 ++ (newCsi2 : post2)
applyInstructionAlternate :: [CrateStack] -> Instruction -> [CrateStack]
applyInstructionAlternate cs (q, csi1, csi2) = finalList
where
prior1 = fst $ splitAt (csi1 - 1) cs
post1 = snd $ splitAt (csi1) cs
-- Decrement by one to account for zero indexing
newCsi1 = drop q (cs !! (csi1 - 1))
movedCrates = take q (cs !! (csi1 - 1))
removedList = prior1 ++ (newCsi1 : post1)
prior2 = fst $ splitAt (csi2 - 1) removedList
post2 = snd $ splitAt (csi2) removedList
newCsi2 = movedCrates ++ (removedList !! (csi2 - 1))
finalList = prior2 ++ (newCsi2 : post2)
solveProblem :: Problem -> [CrateStack]
solveProblem (cs, []) = cs
solveProblem (cs, (ins:inss)) = solveProblem ((applyInstruction cs ins), inss)
solveProblemAlternate :: Problem -> [CrateStack]
solveProblemAlternate (cs, []) = cs
solveProblemAlternate (cs, (ins:inss)) = solveProblemAlternate ((applyInstructionAlternate cs ins), inss)
getTopCrates :: [CrateStack] -> String
getTopCrates cs = map myBespokeHead cs
-- better head, because I'm better lmao
myBespokeHead :: [Char] -> Char
myBespokeHead [] = ' '
myBespokeHead (x:_) = x
processInstruction :: String -> Instruction
processInstruction i = tuplify3 $ map convertToInt filteredString
where
-- Filter the string to only numeric characters, which compose the instruction and appear in order
filteredString = filter (all isDigit) $ words i
stringIsNumber :: String -> Bool
stringIsNumber s = all isDigit s
convertToInt :: String -> Int
convertToInt s = read s :: Int
tuplify3 :: [a] -> (a,a,a)
tuplify3 [x,y,z] = (x, y, z)
processCrates :: String -> [CrateStack]
processCrates i = map (filter isAlpha) $ filter validLine $ transpose $ lines i
where
-- After transposing this function is used to filter for valid lines
validLine x = not $ null $ filter isDigit x
parseInput :: String -> Problem
parseInput i = (processCrates crates, map processInstruction instructions)
where
splitInput = splitOn "\n\n" i
crates = head splitInput
instructions = concat $ map lines $ tail splitInput
day5 :: String -> String
day5 input = getTopCrates solvedState
where
parsedInput = parseInput input
solvedState = solveProblem parsedInput
day5Alternate :: String -> String
day5Alternate input = getTopCrates solvedState
where
parsedInput = parseInput input
solvedState = solveProblemAlternate parsedInput

67
stack.yaml Normal file
View File

@ -0,0 +1,67 @@
# 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
#
# 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-19.33
# 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
# subdirs:
# - auto-update
# - wai
packages:
- .
# Dependency packages to be pulled from upstream that are not in the resolver.
# These entries can reference officially published versions as well as
# forks / in-progress versions pinned to a git hash. For example:
#
# extra-deps:
# - acme-missiles-0.3
# - git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
#
extra-deps:
- split-0.2.3.5
# 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: ">=2.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

19
stack.yaml.lock Normal file
View File

@ -0,0 +1,19 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
packages:
- completed:
hackage: split-0.2.3.5@sha256:f472fa7019647cacac3267742a6f7ac0a5c816f9890e80e4b826cd937436de87,2646
pantry-tree:
sha256: 516449cf535bbfc78cf1a5795d28dd1e0f19b65a07c33a78b45566101fecc534
size: 439
original:
hackage: split-0.2.3.5
snapshots:
- completed:
sha256: 6d1532d40621957a25bad5195bfca7938e8a06d923c91bc52aa0f3c41181f2d4
size: 619204
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/33.yaml
original: lts-19.33

2
test/Spec.hs Normal file
View File

@ -0,0 +1,2 @@
main :: IO ()
main = putStrLn "Test suite not yet implemented"