From 4cb3fa6de434d287bb46ca94c3026880164cb774 Mon Sep 17 00:00:00 2001 From: Shivesh Mandalia Date: Sun, 5 Feb 2023 01:32:03 +0000 Subject: complete day 6 and 7 --- day05/app/Main.hs | 235 ++++++++++++++++++++++ day05/day05.cabal | 34 ++++ day05/examples/input.txt | 513 +++++++++++++++++++++++++++++++++++++++++++++++ day05/examples/test.txt | 9 + 4 files changed, 791 insertions(+) create mode 100644 day05/app/Main.hs create mode 100644 day05/day05.cabal create mode 100644 day05/examples/input.txt create mode 100644 day05/examples/test.txt (limited to 'day05') diff --git a/day05/app/Main.hs b/day05/app/Main.hs new file mode 100644 index 0000000..b56e45b --- /dev/null +++ b/day05/app/Main.hs @@ -0,0 +1,235 @@ +{- +--- Day 5: Supply Stacks --- + +The expedition can depart as soon as the final supplies have been unloaded from the +ships. Supplies are stored in stacks of marked crates, but because the needed supplies are +buried under many other crates, the crates need to be rearranged. + +The ship has a giant cargo crane capable of moving crates between stacks. To ensure none of +the crates get crushed or fall over, the crane operator will rearrange them in a series of +carefully-planned steps. After the crates are rearranged, the desired crates will be at the +top of each stack. + +The Elves don't want to interrupt the crane operator during this delicate procedure, but they +forgot to ask her which crate will end up where, and they want to be ready to unload them as +soon as possible so they can embark. + +They do, however, have a drawing of the starting stacks of crates and the rearrangement +procedure (your puzzle input). For example: + + [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 + +In this example, there are three stacks of crates. Stack 1 contains two crates: crate Z is on +the bottom, and crate N is on top. Stack 2 contains three crates; from bottom to top, they are +crates M, C, and D. Finally, stack 3 contains a single crate, P. + +Then, the rearrangement procedure is given. In each step of the procedure, a quantity of +crates is moved from one stack to a different stack. In the first step of the above +rearrangement procedure, one crate is moved from stack 2 to stack 1, resulting in this +configuration: + +[D] +[N] [C] +[Z] [M] [P] + 1 2 3 + +In the second step, three crates are moved from stack 1 to stack 3. Crates are moved one at a +time, so the first crate to be moved (D) ends up below the second and third crates: + + [Z] + [N] + [C] [D] + [M] [P] + 1 2 3 + +Then, both crates are moved from stack 2 to stack 1. Again, because crates are moved one at a +time, crate C ends up below crate M: + + [Z] + [N] +[M] [D] +[C] [P] + 1 2 3 + +Finally, one crate is moved from stack 1 to stack 2: + + [Z] + [N] + [D] +[C] [M] [P] + 1 2 3 + +The Elves just need to know which crate will end up on top of each stack; in this example, the +top crates are C in stack 1, M in stack 2, and Z in stack 3, so you should combine these +together and give the Elves the message CMZ. + +After the rearrangement procedure completes, what crate ends up on top of each stack? + +--- Part Two --- + +As you watch the crane operator expertly rearrange the crates, you notice the process isn't +following your prediction. + +Some mud was covering the writing on the side of the crane, and you quickly wipe it away. The +crane isn't a CrateMover 9000 - it's a CrateMover 9001. + +The CrateMover 9001 is notable for many new and exciting features: air conditioning, leather +seats, an extra cup holder, and the ability to pick up and move multiple crates at once. + +Again considering the example above, the crates begin in the same configuration: + +``` + [D] +[N] [C] +[Z] [M] [P] + 1 2 3 +``` + +Moving a single crate from stack 2 to stack 1 behaves the same as before: + +``` +[D] +[N] [C] +[Z] [M] [P] + 1 2 3 +``` + +However, the action of moving three crates from stack 1 to stack 3 means that those three moved +crates stay in the same order, resulting in this new configuration: + +``` + [D] + [N] + [C] [Z] + [M] [P] + 1 2 3 +``` + +Next, as both crates are moved from stack 2 to stack 1, they retain their order as well: + +``` + [D] + [N] +[C] [Z] +[M] [P] + 1 2 3 +``` + +Finally, a single crate is still moved from stack 1 to stack 2, but now it's crate C that gets moved: + +``` + [D] + [N] + [Z] +[M] [C] [P] + 1 2 3 +``` + +In this example, the CrateMover 9001 has put the crates in a totally different order: MCD. + +Before the rearrangement process finishes, update your simulation so that the Elves know where +they should stand to be ready to unload the final supplies. After the rearrangement procedure +completes, what crate ends up on top of each stack? +-} +{-# LANGUAGE DerivingStrategies #-} + +module Main (main) where + +import Data.ByteString.Lazy (ByteString) +import Data.Char (digitToInt) +import Options.Applicative (Parser, ParserInfo, argument, execParser, fullDesc, help, helper, info, metavar, str) +import Relude hiding (ByteString, elem, empty, filter, fromList, length, null, optional, readFile, splitAt) +import Text.Parsec (ParseError, parse, ()) +import Text.Parsec.ByteString.Lazy (GenParser) +import Text.Parsec.Char (char, digit, string, upper) +import Text.Parsec.Combinator (eof, many1, sepBy1, sepEndBy1) +import Text.Parsec.Prim (parsecMap, try) + +type Opts :: Type +newtype Opts = Opts {_filename :: Text} deriving stock (Show) + +type Supplies :: Type +newtype Supplies = Supplies {_i :: [[Char]]} deriving stock (Show) + +type Order :: Type +data Order = Order {_amount :: Int, _from :: Int, _to :: Int} deriving stock (Show) + +parseInput :: FilePath -> ByteString -> Either ParseError (Supplies, [Order]) +parseInput = parse $ (,) <$> (supplies <* eol) <*> orders + where + supplies :: GenParser t st Supplies + supplies = Supplies <$> many1 (lineBlock <* eol) <* axis + + lineBlock :: GenParser t st [Char] + lineBlock = block `sepBy1` space + + block :: GenParser t st Char + block = (char '[' *> upper <* char ']') <|> (' ' <$ try (string " ")) + + axis :: GenParser t st [()] + axis = void space *> (void int `sepEndBy1` spaces) <* eol + + orders :: GenParser t st [Order] + orders = many1 order + + order :: GenParser t st Order + order = + Order + <$> (string "move " *> int) + <*> (string " from " *> int) + <*> (string " to " *> int <* (eol <|> eof)) + + space :: GenParser t st Char + space = char ' ' + + spaces :: GenParser t st [Char] + spaces = many1 space + + int :: GenParser t st Int + int = foldl' (\a i -> a * 10 + digitToInt i) 0 <$> many1 digit + + eol :: GenParser t st () + eol = + parsecMap + (const ()) + ( try (string "\n\r") + <|> try (string "\r\n") + <|> string "\n" + <|> string "\r" + "end of line" + ) + +runPart1 :: (Supplies, [Order]) -> (Supplies, [Order]) +runPart1 x = x + +runPart2 :: (Supplies, [Order]) -> Int +runPart2 = undefined + +main :: IO () +main = do + fileName <- toString . _filename <$> execParser opts + rawInput <- readFileLBS fileName + case parseInput fileName rawInput of + Left e -> do + putTextLn "Error parsing input:" + print e + Right r -> do + print $ runPart1 r + print $ runPart2 r + where + opts :: ParserInfo Opts + opts = info (helper <*> options) fullDesc + + options :: Parser Opts + options = Opts <$> filename + + filename :: Parser Text + filename = argument str $ metavar "filename" <> help "Input file" diff --git a/day05/day05.cabal b/day05/day05.cabal new file mode 100644 index 0000000..0923420 --- /dev/null +++ b/day05/day05.cabal @@ -0,0 +1,34 @@ +cabal-version: 2.4 +name: day05 +version: 0.1.0.0 +synopsis: + +-- A URL where users can report bugs. +-- bug-reports: +license: +author: Shivesh Mandalia +maintainer: mail@shivesh.org + +executable day05 + main-is: Main.hs + + -- Modules included in this executable, other than Main. + -- other-modules: + + -- LANGUAGE extensions used by modules in this package. + default-extensions: + NoImplicitPrelude + OverloadedStrings + StandaloneKindSignatures + + build-depends: + , base ^>=4.16.4.0 + , optparse-applicative >=0.17.0.0 + , parsec >=3.1.16.1 + , relude ^>=1.1.0.0 + + hs-source-dirs: app + default-language: Haskell2010 + ghc-options: + -Weverything -Wno-unused-packages -Wno-missing-safe-haskell-mode + -Wno-safe -Wno-missing-import-lists diff --git a/day05/examples/input.txt b/day05/examples/input.txt new file mode 100644 index 0000000..ca57552 --- /dev/null +++ b/day05/examples/input.txt @@ -0,0 +1,513 @@ +[C] [S] [H] +[F] [B] [C] [S] [W] +[B] [W] [W] [M] [S] [B] +[L] [H] [G] [L] [P] [F] [Q] +[D] [P] [J] [F] [T] [G] [M] [T] +[P] [G] [B] [N] [L] [W] [P] [W] [R] +[Z] [V] [W] [J] [J] [C] [T] [S] [C] +[S] [N] [F] [G] [W] [B] [H] [F] [N] + 1 2 3 4 5 6 7 8 9 + +move 2 from 5 to 9 +move 3 from 1 to 7 +move 2 from 3 to 9 +move 6 from 9 to 5 +move 2 from 3 to 8 +move 9 from 7 to 8 +move 15 from 8 to 9 +move 3 from 1 to 6 +move 6 from 4 to 2 +move 6 from 5 to 6 +move 1 from 4 to 2 +move 14 from 6 to 2 +move 2 from 1 to 5 +move 1 from 7 to 3 +move 1 from 4 to 8 +move 2 from 5 to 6 +move 25 from 2 to 4 +move 2 from 6 to 4 +move 1 from 8 to 1 +move 2 from 9 to 1 +move 1 from 6 to 1 +move 2 from 1 to 7 +move 1 from 7 to 3 +move 2 from 1 to 8 +move 1 from 2 to 6 +move 1 from 3 to 8 +move 4 from 5 to 6 +move 1 from 5 to 3 +move 1 from 9 to 6 +move 2 from 3 to 4 +move 1 from 2 to 6 +move 12 from 9 to 7 +move 1 from 9 to 1 +move 1 from 5 to 8 +move 1 from 3 to 8 +move 28 from 4 to 5 +move 1 from 4 to 3 +move 1 from 2 to 6 +move 1 from 3 to 9 +move 12 from 7 to 2 +move 1 from 9 to 6 +move 6 from 6 to 4 +move 1 from 7 to 4 +move 1 from 1 to 2 +move 28 from 5 to 1 +move 2 from 2 to 8 +move 3 from 8 to 2 +move 7 from 4 to 1 +move 4 from 8 to 6 +move 9 from 2 to 8 +move 7 from 6 to 5 +move 3 from 5 to 9 +move 1 from 9 to 7 +move 1 from 7 to 1 +move 5 from 8 to 4 +move 4 from 1 to 9 +move 6 from 9 to 4 +move 5 from 1 to 5 +move 5 from 2 to 3 +move 4 from 8 to 2 +move 5 from 1 to 4 +move 4 from 5 to 9 +move 9 from 4 to 9 +move 10 from 9 to 8 +move 1 from 9 to 1 +move 2 from 2 to 8 +move 4 from 3 to 8 +move 1 from 2 to 3 +move 2 from 9 to 2 +move 1 from 2 to 6 +move 4 from 4 to 3 +move 3 from 5 to 1 +move 12 from 1 to 4 +move 1 from 5 to 3 +move 1 from 5 to 3 +move 5 from 8 to 5 +move 7 from 8 to 5 +move 8 from 3 to 4 +move 1 from 5 to 1 +move 1 from 6 to 7 +move 2 from 1 to 6 +move 8 from 5 to 9 +move 2 from 5 to 1 +move 9 from 1 to 4 +move 20 from 4 to 2 +move 1 from 5 to 2 +move 4 from 4 to 2 +move 5 from 9 to 2 +move 2 from 8 to 9 +move 23 from 2 to 4 +move 2 from 2 to 5 +move 5 from 1 to 2 +move 28 from 4 to 3 +move 2 from 8 to 1 +move 2 from 5 to 7 +move 1 from 6 to 9 +move 1 from 4 to 8 +move 1 from 8 to 9 +move 1 from 4 to 6 +move 2 from 7 to 2 +move 13 from 3 to 4 +move 5 from 9 to 7 +move 1 from 9 to 6 +move 14 from 2 to 6 +move 1 from 4 to 1 +move 10 from 3 to 2 +move 1 from 6 to 9 +move 2 from 3 to 2 +move 3 from 1 to 9 +move 1 from 3 to 5 +move 3 from 9 to 3 +move 6 from 7 to 4 +move 1 from 9 to 4 +move 1 from 9 to 2 +move 1 from 5 to 3 +move 5 from 3 to 1 +move 17 from 4 to 7 +move 2 from 2 to 8 +move 1 from 3 to 9 +move 1 from 8 to 2 +move 1 from 9 to 6 +move 4 from 6 to 2 +move 10 from 6 to 5 +move 4 from 1 to 5 +move 15 from 2 to 9 +move 1 from 8 to 6 +move 1 from 2 to 8 +move 6 from 9 to 2 +move 3 from 4 to 8 +move 11 from 7 to 1 +move 6 from 9 to 6 +move 1 from 6 to 2 +move 3 from 9 to 3 +move 6 from 2 to 7 +move 6 from 7 to 8 +move 7 from 1 to 9 +move 4 from 1 to 6 +move 2 from 1 to 2 +move 4 from 6 to 7 +move 1 from 2 to 9 +move 1 from 2 to 3 +move 1 from 2 to 1 +move 6 from 8 to 4 +move 2 from 6 to 7 +move 13 from 5 to 9 +move 1 from 5 to 4 +move 3 from 4 to 7 +move 1 from 1 to 7 +move 14 from 9 to 2 +move 2 from 9 to 3 +move 3 from 8 to 5 +move 4 from 3 to 4 +move 8 from 4 to 1 +move 7 from 1 to 9 +move 5 from 6 to 9 +move 4 from 9 to 2 +move 1 from 1 to 9 +move 17 from 2 to 4 +move 1 from 6 to 3 +move 4 from 7 to 5 +move 5 from 7 to 5 +move 1 from 6 to 4 +move 1 from 8 to 3 +move 5 from 7 to 1 +move 2 from 7 to 6 +move 2 from 3 to 6 +move 1 from 2 to 9 +move 7 from 9 to 6 +move 2 from 3 to 7 +move 8 from 6 to 4 +move 3 from 9 to 2 +move 1 from 6 to 4 +move 26 from 4 to 8 +move 2 from 7 to 8 +move 5 from 5 to 9 +move 2 from 6 to 7 +move 4 from 9 to 1 +move 2 from 7 to 5 +move 14 from 8 to 6 +move 3 from 2 to 8 +move 3 from 6 to 8 +move 3 from 6 to 1 +move 10 from 8 to 4 +move 5 from 9 to 4 +move 3 from 8 to 5 +move 1 from 8 to 2 +move 12 from 4 to 8 +move 1 from 9 to 3 +move 6 from 6 to 4 +move 6 from 8 to 2 +move 1 from 3 to 8 +move 1 from 8 to 4 +move 10 from 1 to 9 +move 2 from 1 to 3 +move 7 from 4 to 9 +move 1 from 2 to 1 +move 11 from 8 to 9 +move 1 from 3 to 9 +move 2 from 2 to 7 +move 1 from 3 to 6 +move 2 from 7 to 9 +move 2 from 4 to 6 +move 4 from 6 to 4 +move 2 from 2 to 8 +move 2 from 8 to 4 +move 1 from 1 to 7 +move 2 from 2 to 8 +move 9 from 5 to 2 +move 3 from 5 to 9 +move 1 from 8 to 3 +move 30 from 9 to 7 +move 1 from 6 to 2 +move 7 from 4 to 8 +move 13 from 7 to 2 +move 8 from 7 to 4 +move 2 from 4 to 8 +move 8 from 8 to 1 +move 1 from 8 to 3 +move 2 from 8 to 9 +move 1 from 3 to 7 +move 5 from 7 to 6 +move 1 from 3 to 1 +move 7 from 4 to 8 +move 20 from 2 to 6 +move 2 from 2 to 7 +move 1 from 9 to 5 +move 4 from 7 to 6 +move 3 from 7 to 8 +move 1 from 7 to 2 +move 7 from 8 to 6 +move 3 from 6 to 7 +move 4 from 9 to 1 +move 1 from 2 to 6 +move 1 from 9 to 7 +move 1 from 2 to 8 +move 1 from 7 to 6 +move 3 from 6 to 3 +move 4 from 8 to 1 +move 8 from 6 to 4 +move 3 from 7 to 2 +move 1 from 3 to 2 +move 1 from 4 to 5 +move 2 from 3 to 5 +move 1 from 4 to 6 +move 4 from 1 to 5 +move 4 from 2 to 9 +move 2 from 1 to 6 +move 4 from 9 to 2 +move 3 from 2 to 8 +move 2 from 8 to 4 +move 13 from 6 to 1 +move 4 from 5 to 2 +move 14 from 6 to 3 +move 1 from 2 to 7 +move 2 from 2 to 4 +move 1 from 8 to 6 +move 1 from 6 to 3 +move 1 from 7 to 4 +move 1 from 2 to 3 +move 1 from 2 to 6 +move 11 from 4 to 6 +move 2 from 5 to 4 +move 1 from 5 to 6 +move 12 from 3 to 6 +move 1 from 3 to 7 +move 1 from 5 to 7 +move 3 from 3 to 6 +move 2 from 7 to 5 +move 2 from 5 to 2 +move 8 from 6 to 7 +move 24 from 1 to 3 +move 1 from 4 to 6 +move 10 from 3 to 1 +move 6 from 1 to 8 +move 1 from 6 to 3 +move 1 from 4 to 2 +move 1 from 3 to 1 +move 2 from 2 to 1 +move 1 from 7 to 6 +move 2 from 7 to 5 +move 4 from 3 to 7 +move 1 from 2 to 3 +move 6 from 1 to 6 +move 3 from 7 to 5 +move 4 from 7 to 8 +move 1 from 1 to 2 +move 1 from 2 to 7 +move 8 from 3 to 4 +move 3 from 4 to 7 +move 6 from 8 to 6 +move 2 from 3 to 2 +move 1 from 3 to 9 +move 5 from 5 to 1 +move 2 from 8 to 2 +move 1 from 9 to 2 +move 4 from 1 to 3 +move 3 from 2 to 9 +move 1 from 1 to 2 +move 2 from 9 to 7 +move 2 from 2 to 9 +move 8 from 7 to 5 +move 33 from 6 to 5 +move 20 from 5 to 9 +move 21 from 5 to 7 +move 17 from 7 to 6 +move 10 from 6 to 9 +move 5 from 4 to 7 +move 2 from 3 to 9 +move 1 from 2 to 3 +move 2 from 7 to 3 +move 3 from 9 to 5 +move 23 from 9 to 7 +move 8 from 9 to 6 +move 1 from 9 to 1 +move 1 from 5 to 3 +move 1 from 8 to 9 +move 5 from 6 to 8 +move 1 from 9 to 6 +move 18 from 7 to 2 +move 6 from 7 to 4 +move 6 from 4 to 8 +move 5 from 7 to 4 +move 6 from 6 to 3 +move 1 from 4 to 2 +move 10 from 2 to 1 +move 1 from 2 to 4 +move 7 from 1 to 6 +move 1 from 7 to 1 +move 11 from 6 to 2 +move 1 from 6 to 8 +move 12 from 3 to 1 +move 8 from 1 to 8 +move 2 from 5 to 2 +move 12 from 8 to 6 +move 15 from 2 to 4 +move 7 from 4 to 5 +move 4 from 5 to 9 +move 4 from 9 to 4 +move 5 from 4 to 6 +move 2 from 5 to 2 +move 1 from 2 to 5 +move 2 from 5 to 4 +move 2 from 1 to 3 +move 4 from 1 to 5 +move 2 from 8 to 4 +move 5 from 2 to 9 +move 17 from 6 to 8 +move 1 from 3 to 2 +move 2 from 5 to 4 +move 1 from 3 to 8 +move 1 from 1 to 6 +move 2 from 5 to 6 +move 3 from 9 to 5 +move 1 from 5 to 1 +move 3 from 1 to 8 +move 26 from 8 to 4 +move 1 from 5 to 3 +move 3 from 2 to 7 +move 1 from 5 to 7 +move 21 from 4 to 9 +move 19 from 4 to 5 +move 3 from 4 to 3 +move 2 from 7 to 5 +move 1 from 8 to 2 +move 1 from 6 to 2 +move 1 from 8 to 9 +move 1 from 6 to 7 +move 1 from 2 to 4 +move 1 from 4 to 7 +move 1 from 2 to 7 +move 1 from 7 to 1 +move 1 from 1 to 6 +move 1 from 3 to 5 +move 2 from 6 to 3 +move 13 from 5 to 8 +move 1 from 4 to 2 +move 3 from 5 to 4 +move 5 from 5 to 4 +move 5 from 8 to 9 +move 9 from 9 to 3 +move 2 from 7 to 1 +move 6 from 4 to 2 +move 8 from 9 to 4 +move 1 from 2 to 7 +move 12 from 9 to 8 +move 1 from 4 to 2 +move 3 from 7 to 3 +move 11 from 8 to 5 +move 5 from 8 to 6 +move 3 from 6 to 5 +move 2 from 4 to 1 +move 13 from 5 to 3 +move 1 from 1 to 7 +move 2 from 1 to 8 +move 3 from 4 to 9 +move 1 from 1 to 7 +move 1 from 2 to 4 +move 2 from 7 to 3 +move 1 from 5 to 3 +move 4 from 4 to 2 +move 1 from 4 to 9 +move 30 from 3 to 2 +move 1 from 9 to 7 +move 6 from 8 to 6 +move 1 from 7 to 6 +move 1 from 5 to 1 +move 1 from 3 to 5 +move 30 from 2 to 3 +move 1 from 1 to 9 +move 2 from 9 to 2 +move 9 from 6 to 9 +move 2 from 2 to 9 +move 1 from 5 to 1 +move 5 from 9 to 7 +move 8 from 2 to 5 +move 1 from 1 to 9 +move 3 from 9 to 1 +move 5 from 3 to 6 +move 8 from 5 to 9 +move 13 from 3 to 9 +move 3 from 1 to 7 +move 5 from 7 to 9 +move 17 from 9 to 6 +move 1 from 7 to 6 +move 6 from 3 to 9 +move 1 from 2 to 1 +move 2 from 7 to 1 +move 1 from 2 to 5 +move 21 from 9 to 2 +move 4 from 3 to 6 +move 6 from 6 to 5 +move 7 from 5 to 9 +move 2 from 3 to 8 +move 3 from 1 to 3 +move 4 from 6 to 5 +move 1 from 8 to 1 +move 1 from 8 to 2 +move 4 from 5 to 2 +move 4 from 9 to 1 +move 4 from 3 to 5 +move 2 from 1 to 7 +move 1 from 7 to 4 +move 3 from 9 to 5 +move 25 from 2 to 9 +move 18 from 9 to 1 +move 1 from 4 to 5 +move 1 from 3 to 8 +move 4 from 5 to 6 +move 2 from 9 to 3 +move 17 from 1 to 5 +move 1 from 2 to 7 +move 2 from 3 to 5 +move 3 from 1 to 8 +move 5 from 9 to 2 +move 4 from 8 to 9 +move 12 from 5 to 2 +move 1 from 1 to 8 +move 3 from 9 to 5 +move 1 from 8 to 2 +move 2 from 7 to 2 +move 1 from 9 to 5 +move 9 from 5 to 2 +move 6 from 6 to 2 +move 15 from 6 to 2 +move 5 from 5 to 9 +move 1 from 5 to 9 +move 3 from 9 to 2 +move 3 from 9 to 1 +move 1 from 1 to 9 +move 1 from 9 to 1 +move 19 from 2 to 8 +move 2 from 1 to 9 +move 33 from 2 to 6 +move 4 from 6 to 4 +move 1 from 2 to 6 +move 1 from 9 to 8 +move 3 from 4 to 8 +move 18 from 8 to 3 +move 1 from 4 to 9 +move 10 from 3 to 9 +move 1 from 1 to 4 +move 24 from 6 to 3 +move 1 from 4 to 3 +move 2 from 8 to 7 +move 8 from 9 to 3 +move 5 from 6 to 7 +move 35 from 3 to 2 +move 7 from 7 to 1 +move 3 from 1 to 3 +move 33 from 2 to 6 +move 6 from 3 to 7 +move 5 from 7 to 3 +move 1 from 1 to 4 +move 1 from 7 to 8 +move 1 from 4 to 8 +move 1 from 3 to 2 +move 30 from 6 to 5 +move 2 from 1 to 6 +move 5 from 8 to 1 +move 1 from 9 to 2 +move 2 from 6 to 4 +move 4 from 1 to 7 +move 21 from 5 to 8 diff --git a/day05/examples/test.txt b/day05/examples/test.txt new file mode 100644 index 0000000..84933bb --- /dev/null +++ b/day05/examples/test.txt @@ -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 -- cgit v1.2.3