Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mitsunee/advent-of-code-2023
My solutions for Advent of Code 2023 written in TypeScript
https://github.com/mitsunee/advent-of-code-2023
advent-of-code advent-of-code-2023
Last synced: 14 days ago
JSON representation
My solutions for Advent of Code 2023 written in TypeScript
- Host: GitHub
- URL: https://github.com/mitsunee/advent-of-code-2023
- Owner: Mitsunee
- License: mit
- Created: 2023-12-01T10:06:39.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-19T17:05:43.000Z (about 1 year ago)
- Last Synced: 2024-11-15T03:47:26.119Z (3 months ago)
- Topics: advent-of-code, advent-of-code-2023
- Language: TypeScript
- Homepage:
- Size: 214 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 2023
My solutions for Advent of Code 2023 written in TypeScript
## Installation
Install Node 18.x and pnpm 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
```Note: Some days are split into separate files like `part-1.ts` and `part-2.ts`. `tsx` can also be used to run only a single test by running it as a script!
## 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
```## Stars: 31/50
| Week | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
| :--: | :-------: | :------: | :-------: | :-------: | :-------: | :-------: | :------: |
| 1 | | | | | 1st ⭐⭐ | 2nd ⭐⭐ | 3rd ⭐⭐ |
| 2 | 4th ⭐⭐ | 5th ⭐⭐ | 6th ⭐⭐ | 7th ⭐⭐ | 8th ⭐⭐ | 9th ⭐⭐ | 10th ⭐ |
| 3 | 11th ⭐⭐ | 12th | 13th ⭐⭐ | 14th ⭐⭐ | 15th ⭐⭐ | 16th ⭐⭐ | 17th |
| 4 | 18th ⭐ | 19th ⭐ | 20th | 21st | 22nd | 23rd | 24th |
| 5 | 25th | | | | | | |### Skipped Stars:
Day 10 Part 2
Could not figure out a way to determine whether a tile is actually enclosed by the loop. I attempted upscaling the grid to make it a simple pathfinding exercise, but could not get that working yet. May revisit later.
Day 12
Didn't manage to figure out the correct approach to part 1. Only got a partial solution for blocks that can only have one position starting from the start or end of the string + recursive, but this ended up already having too many bugs.
Day 17
I have literally never done pathfinding algorithms and this puzzle adds an additional problem to simply comparing cost of reaching a tile, since a more expensive solution may have access to a cheaper rest of the path. I heard that Dijkstra's algorithm is easier than A*, but could not figure out how it would work with the "move at most 3 tiles in the same direction" limitation.
Day 18 Part 2
My solution works in theory, but in reality uses too much RAM, so Node.js crashes with "JavaScript heap out of memory"
Update: I started attempting a solution based on the shoelace algorithm that Tipa showed me, but could not get it to output the correct value for the AoC example, but the wikipedia example (--part debug) works as intended.
Day 19 Part 2
I think I understood that I need to resolve the workflow steps into a binary tree where each comparison splits a hypercube, but I'm doing something wrong. From manual checking the culling of workflows that always result in the same outcome does work properly, I'm just not splitting the hypercube correctly. May revisit later.