from Enjoy the detours!

Typescript

https://toot.cafe/@danbruegge/113604656521141559

Done in the morning without problems, again and again. 😎

Code

Finally. :) I've got ⭐⭐ on Day 4. Once you get the hang of it, Part 2 is easily solvable. 😎

I'm so happy right now. And I'm excited about the next challenge.

100DaysToOffload

Regarding the #100DaysToOffload challenge, I'm halfway through. Another achievement today. πŸ₯³


50 of #100DaysToOffload

#log #AdventOfCode #AdventOfTypescript

Thoughts?

 
Weiterlesen... Discuss...

from Enjoy the detours!

Typescript

https://toot.cafe/@danbruegge/113599034688863789

Done in the morning without problems, again. 😎

Code

Because of my current work schedule, I had no time, so no progress here. I have looked into today's challenge, but still need to do Day 4. Over the day I had some ideas which I like to test and play with. It's doable. Reminds me a bit of 2D tile maps. Which is a long time since I did anything with it. Maybe I was 14–16 years old. In my RPG-Maker days. Because of family stuff on the weekend, I don't see me completing the Day 4 challenge before next week. I completely underestimated how hard these challenges are, for me. πŸ˜…


49 of #100DaysToOffload

#log #adventOfCode #adventOfTypescript

Thoughts?

 
Weiterlesen... Discuss...

from Enjoy the detours!

Typescript

https://toot.cafe/@danbruegge/113593611272804600

Done in the morning without problems. 😎

Code

First time, where I will not get it done on time. So far, I've committed my current state and pushed it to my gitea instance. Let's see if I can get it done tomorrow. I think my solution is simple enough, but I lack experience in this area. In the last hour, I was just try and error'ing my way through the code.

It really annoys me that I didn't make it. As an excuse, my workday was quite heavy, and I need to recharge first.

Maybe tomorrow will be better. ✌️


48 of #100DaysToOffload

#log #adventOfCode #adventOfTypescript

Thoughts?

 
Weiterlesen... Discuss...

from Enjoy the detours!

Typescript

https://toot.cafe/@danbruegge/113587602136584312

I solved this one β€œearly” in the morning. This one, was also a no-brainer.

Code

https://toot.cafe/@danbruegge/113588572520140901

This was a nice and fast one. I always enjoy playing with Regexp. Only Part 2 gave me a struggle, because of my thought process. I tend to do things much more complicated than they should be. :D

Here is a little example:

export function getDoMulCalls(input: string): any {
  const startRe = /^(.*?)don\'t\(\)/g;
  const middleRe = /do\(\)(.*?)don\'t\(\)/g;
  const endRe = /do\(\)(.*?)$/g;

  const startDos = Array.from(input.matchAll(startRe), match => match[1]);
  const middleDos = Array.from(input.matchAll(middleRe), match => match[1]);
  const endDos = Array.from(input.matchAll(endRe), match => match[1]).filter(endDo => !endDo.includes("don't()"));

  return [...startDos, ...middleDos, ...endDos].map(getMulCalls).flat();
}

This will not give you the solution to Part 2. I thought this was simple and clever at the same time. But I needed to start fresh and remove the cleverness from the code. Bonus, I've learned something new with JavaScript and Regexp. :)


47 of #100DaysToOffload

#log #adventOfCode #adventOfTypescript

Thoughts?

 
Weiterlesen... Discuss...

Join the writers on Write.as.

Start writing or create a blog