Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mitsunee/advent-of-code-2024
My solutions for Advent of Code 2024 written in TypeScript
https://github.com/mitsunee/advent-of-code-2024
advent-of-code advent-of-code-2024
Last synced: 12 days ago
JSON representation
My solutions for Advent of Code 2024 written in TypeScript
- Host: GitHub
- URL: https://github.com/mitsunee/advent-of-code-2024
- Owner: Mitsunee
- License: mit
- Created: 2024-11-30T23:00:36.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-27T15:35:23.000Z (19 days ago)
- Last Synced: 2024-12-27T18:11:53.023Z (19 days ago)
- Topics: advent-of-code, advent-of-code-2024
- Language: TypeScript
- Homepage:
- Size: 209 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Advent of Code 2024
My solutions for Advent of Code 2024 written in TypeScript
## Installation
Install Node 22.x and pnpm 9.x then run
```shell
pnpm install
```## Tests
```shell
pnpm typecheck && pnpm test
```### Running a script or single test
Since the code in this repository is written in TypeScript `tsx` is needed to run scripts:
```shell
pnpm tsx src/day-n/script.ts
```### Running tests for a specific day
To run all tests in only a specific directory a special `test:dir` script is used:
```shell
pnpm test:dir src/day-n
```## Prepare script
To create a src directory for starting a solution with the script template simply run `./prepare.sh`.
If used out-of-season the script also takes a day number as parameter like `./prepare.sh 06`. See also `./prepare.sh --help`.
## Stars: 40/50
| Week | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
| :--: | :-------: | :-------: | :-------: | :-------: | :-------: | :-------: | :-------: |
| 1 | | | | | | | 1st ⭐⭐ |
| 2 | 2nd ⭐⭐ | 3rd ⭐⭐ | 4th ⭐⭐ | 5th ⭐⭐ | 6th ⭐⭐ | 7th ⭐⭐ | 8th ⭐⭐ |
| 3 | 9th ⭐⭐ | 10th ⭐⭐ | 11th ⭐ | 12th ⭐⭐ | 13th ⭐ | 14th ⭐⭐ | 15th ⭐⭐ |
| 4 | 16th | 17th | 18th ⭐⭐ | 19th ⭐⭐ | 20th ⭐⭐ | 21st ⭐ | 22nd ⭐ |
| 5 | 23rd ⭐⭐ | 24th ⭐ | 25th ⭐ |### Skipped Stars:
Day 11 Part 2
Could not come up with a solution that doesn't run out of memory in the high 30s. I'm assuming there's some sort of pattern one could take advantage of with the given ruleset, but I'm not the person to figure that out.
I also saw this is really easily solved by adding caching on top of what I already had, but sadly Map in JS only takes a single key, unlike python dicts, which makes implementing caching a lot harder.
Day 13 Part 2
That's just maths and it's 23:16 now and I'm too tired for this. Got some hints from reddit: Each machine has at most one solution. Apparently that means binary search is possible, but I could not figure out how to evaluate whether I'm too high or too low.
Day 16
I have yet to actually learn a pathfinding algorithm other than bruteforce and both of my attempts at this failed. First I tried to avoid the obvious 'Maximum Callstack size exceed' error by looping over an array instead, which eventually just overfilled memory. Recursion did yield the expected error almost immediatly. Examples do work in both at least.
Update: I tried again with a speed optimization (using Sets and a Queue instead of arrays), but this didn't help the memory issue. I also attempted to save memory by abandoning paths that already got more expensive than the cheapest completed path, but my script was never able to actually finish a path as it kept hitting deadends.
Update 2: I have now actually learned Dijkstra's Shortest Path to solve day 18, so I'll likely reattempt this after I've caught up
Day 17
Could not understand instructions, may attempt again later.
Day 21 Part 2
Needs some sort of caching, but with how I implemented the robots I don't know if I can even add that
Day 22 Part 2
This seems impossible with the amount of input lines. Would probably run out of memory if I were to generate the sequences for every input to compare, so there's likely some math nonsense going on here. Sadly I remain a freelance frontend dev, not a university professor.
Day 24 Part 2
I was trying to analyze my input a bit, to have some assumptions to work with, so I determined I wanted to check if a swap exists that fixes 3 of the incorrect zeros. Literally the first swap my code would try after sorting by what's most likely created an infinite loop and I'm honestly out of ideas for what to try other than bruteforce (which would also need a way to detect loops)
Day 25 Part 2
Star not available unless all other puzzles are solved
## Previous Years I participated
- [2023](https://github.com/mitsunee/advent-of-code-2023)