๐งช View test coverage
Advent of Code 2023 ๐ (TDD + Node.js) - Will I complete it this year? ๐ฎ
What a rollercoaster of emotions ! ๐ข
From "Easy peasy, lemon squeezie ๐" to "I hate Christmas ๐คฌ, I hate myself ๐ญ, why am I doing this ๐ซ " to "OMG, is it actually working ? ๐ฅน"
- I tried to handle zero cases ... It was not necessary ๐คก
- For puzzle 2, I first simply tried to iterate through a digit array and replace occurences. Of course, overlapping cases (like "zoneight") revealed bugs.
- I thought "zoneight" was supposed to return 11... It was actually supposed to return 18 ๐คก (Thanks again Sara!)
- My way to handle puzzle 2 was to sanitize the overlapping characters first, then replace the occurences.
- ๐
replaceAll
- ๐ก TIL: Read the text carefully and in your communities you shall trust! (So much love for you Sara ๐)
- ๐ค Access the code

- This time, I stick to the case given in the website and... it's done in 30mn! ๐ฅณ
- I approach things little by little: I used Regex101 to help me figuring out the regex to extract my game ID, how to construct my colors object ... Baby steps encouraged by TDD are not my strongest asset ...
- I'm thinking about having a helper file for functions that are used by several days (it's likely i'll have to read in a file everyday this month...)
- ๐ Approaching this in a TDD way definitely helps !
- I got stuck on an error on my Regexp that was not isolating the game ID properly ... (see this commit to handle game IDs that are on 2/3 digits) That was a tricky one!
- Access the code
- It was super hard!
- I first handled only characters that were specified in the example. But I didn't commit it ...
- I dropped this day ! ๐ช
- ๐ค Access the code
- It was smooth compared to Day 3.
- I had to read the description multiple times concerning how the points were distributed...
- I had trouble understanding the description, I decided to skip part 2.
- Not enough time to understand it for now.
- Part 1 was extremely smooth ! ๐ฅน
- I built the matrix containing the universes
- ๐ก The method
every
(MDN) - I had my matrix but I was having a hard time picturing how I would implement the path resolution. After browsing Reddit, I got inspired by someone who was calculating distance thanks to the position of the galaxy (it's called Manhattan distance btw)
- I decided to measure my time resolving advent of code: I don't want to spent more than 2 hours on these puzzles. The part 1 took me 1h45, so I won't be doing part 2 !
- Even if I'm not doing all days, I decided to do only days that inspire me to write something "clean" and to write something in this daily log (well, at least understandable ^^' ) ๐งฝ
- I noticed that I was having less pleasure the past days and I was not taking time to write down my impressions about the day.
- Hopefully, I'll be faster next year ๐ข
- Understanding the description is hard ... again.
- I decide to start with the first "tilt" part of rocks (make rocks go all the way north!)
- First step was very straightforward to implement ... which freaks me out for part two ^^'
- Since the other days don't inspire me, I decide to keep going !
- This article helped me understand what was expected for part 2. Here's the extract that helped me
Now, the specifics of both instructions.
โ The remove instruction:
If the label you are searching for is not inside its box, do nothing. If the label you are searching for is present, remove it and shift all other lenses forward.
โ The add instruction:
If a lens with the label you are searching for is present, update its focal length (the number right of the = in the instruction). If a lens with the label you are searching for is not present, add the lens to the end of the box.
- ๐ก findIndex
- I feel like I'm rambling but I had a hard time understanding what's expected.
- I manipulated the Map type in Javascript, pretty convenient.
- Recursivity can be helpful! (even though my method
computeIfPartAccepted
is ugly ๐ณ)
- I'm glad I had my
buildMatrix
function ready to use in my helpers ! - Struggling with recursivity: I wanted to do multiple things in the same time (explore and count possible steps), I decided to separate things and mark the possible plots in the matrix, THEN count the plots.
- Difficulties understanding when is a plot considered like "reachable" after the second step. Some . switch to O, other don't... ๐ฎ I'm currently stuck on this problem.
- This advent of code was a great way to refresh my data structure knowledge (matrices exploration), I'm definitely rusty.
Array
provides a lot of handy functions (findIndex
,fill
...) that I don't use that often !- Avoid complex solutions : in simplicity we trust!