Skip to content

leiluspocus/advent-of-code-2023

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

41 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

advent-of-code-2023

advent of code test coverage workflow

๐Ÿงช View test coverage


Advent of Code 2023 ๐ŸŽ… (TDD + Node.js) - Will I complete it this year ? ๐Ÿ”ฎ

Day 1

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
Meme found on Reddit, joking on how complex oneight case was

Source: Reddit

Day 2

  • 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

Day 3

  • 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

Day 4

  • 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.

Day 5

  • Not enough time to understand it for now.

Day 6

  • Part 1 was extremely smooth ! ๐Ÿฅน

Day 11

  • 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 ๐ŸŽข

Day 14

  • Understanding the description is hard ... again.
  • I decide to start with the first "tilt" part of rocks (make rocks go all the way north!)

Day 15

  • 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.

Day 19

  • 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 ๐Ÿ˜ณ)

Day 21 โŒ

  • 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.

Lessons learned

  • 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!

About

Advent of Code 2023 ๐ŸŽ… (TDD + Node.js) - Will I complete it this year ? ๐Ÿ”ฎ (Spoiler: no)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published