Solving day 5 of Advent of Code 2022 in JavaScript

preview_player
Показать описание
Advent of Code is a website that releases a new programming puzzle every day between the 1st and the 25th of December.

0:00 Parsing stacks
12:45 Parsing moves
17:35 Part 1
22:42 Part 2

Have fun!

Рекомендации по теме
Комментарии
Автор

I know I’m super late with advent of code but I didn’t have time in December so I’m working my way through when I can.
I love watching how you think and process stuff.

I was a bit overwhelmed trying to figure out how to read the input file in correctly and you made it look so easy here! Thank you for taking the time to do these vids. They really do help (and not in the cheating way, your only cheating yourself if you copy, paste and don’t understand what your doing) looking forward to completing the gold stars (eventually and hopefully by start of AoC23 😂)

AlleyDev
Автор

Thanks for using `unshift()`.
I had just looped starting at the bottom, but `unshift` is more elegant to my eyes.

queuebit
Автор

Saut Thibault, really nice video, unfortunately today's challenge is out of my focus and knowledge ^^' but i learned a lot watching you suffer aha

thomas-gkjp
Автор

I went with a more different way to parse those moves:
const moves = rawMoves.map((move: string) => {
const num = move.split(' ');
return {
count: parseInt(num[1]),
from: parseInt(num[3]),
to: parseInt(num[num.length - 1])
}
})

gixxerblade
Автор

Have you thought about using quokka for live log previewing? I've started using it recently and it actually helps a lot i think

lemmoor