Skip to content

Commit

Permalink
day 5 done (for now)
Browse files Browse the repository at this point in the history
so the dumb method of actually trying everything works.
example is fast enough, let's call it here.

need to go back later to optimize a bit for sure.
  • Loading branch information
Javran committed Jan 8, 2024
1 parent a70fbe8 commit 92bbd02
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Solutions, scripting, and templates - all in one repo.

| `<++++++++>` | `<++++++++>` | `<++++++++>` | `<++++++++>` | `<++++++++>` |
| :-: | :-: | :-: | :-: | :-: |
|[Day 1](src/Javran/AdventOfCode/Y2023/Day1.hs) |[Day 2](src/Javran/AdventOfCode/Y2023/Day2.hs) |[Day 3](src/Javran/AdventOfCode/Y2023/Day3.hs) |[Day 4](src/Javran/AdventOfCode/Y2023/Day4.hs) | [Day 5](src/Javran/AdventOfCode/Y2023/Day5.hs) |
|[Day 1](src/Javran/AdventOfCode/Y2023/Day1.hs) |[Day 2](src/Javran/AdventOfCode/Y2023/Day2.hs) |[Day 3](src/Javran/AdventOfCode/Y2023/Day3.hs) |[Day 4](src/Javran/AdventOfCode/Y2023/Day4.hs) | [Day 5](src/Javran/AdventOfCode/Y2023/Day5.hs) |

### 2022

Expand Down
2 changes: 2 additions & 0 deletions data/testdata/2023/day/5/example.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
35
46
4 changes: 3 additions & 1 deletion src/Javran/AdventOfCode/Y2023/Day5.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ mkMapper xs = auxLookup
where
(lm, cur, _) = IM.splitLookup i m

-- TODO: may want to go back and figure out how to do this faster.
-- TODO: I feel IntMap might have added too much overhead to our liking. need to try a linear version.
instance Solution Day5 where
solutionSolved _ = False
solutionSolved _ = True
solutionRun _ SolutionContext {getInputS, answerShow} = do
(seeds, maps) <- consumeOrDie almanacP <$> getInputS
let ff = foldl' (\r m -> mkMapper m . r) id maps
Expand Down
2 changes: 1 addition & 1 deletion test/Javran/AdventOfCode/TestdataSpec.hs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 92bbd02

Please sign in to comment.