Day 7 gave me a bit of a struggle and I went with the easy solution by creating a union and hard-coded the expected array into the type. I'm sure there is a better solution, but I didn't find anything.
Here is my solution. So it is not wrong because it takes the test green. But we know that this will not mean that the solution is correct. :D
Like the days 1-6, they were effortless. I expect that the next days will be harder.
Code
No real progress since Friday. I've looked into Day 5 and skipped it for now. I've started to write code for Day 6, which makes a lot of fun I'm not at the end. The last time I've looked into 2D Tile maps, was +10 years ago.
I think this is the first time, the YouTube algorithm hits a nerve.
The Wolston Butchers channeling everything I love about Skatepunk or Melodicpunk. It's like all the great bands in this scene had a baby which grew up in perfect conditions.
Sadly, they are quite young and don't have enough output to fulfill my needs. 😅 But I'm all-in for every new release from them.
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. 😅
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.
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. :)
Part 2 gave me a real struggle. I just got it by luck and think that my original solution is still right, provided all the information there was on the page. Out of desperation, I have thrown my solution for Part 2 overboard and decided to try a different approach. It makes sense. But if you compare it with the information on that page, it makes less to no sense. Until this point, I've had a lot of fun and hopefully the challenge tomorrow is not easier, but the information on the page tells everything you need to know.
In 2023, I've participated in the Advent of Typescript for 8 Days. Currently, I don't understand why I didn't continue with it because it made a lot of fun. This year, I've resolved to complete as much as I can in Advent of Typescript, but also to join the Advent of Code 2024 and do here also as much as I can.
For the Advent of Code 2024, I've decided to make it plain and simple with vite + typescript. To do more Test Driven Development, I will first write a test and add the code after.
Visually, Advent of Typescript looks really nice. They let you write and test your types inside the browser, which makes writing there quite satisfying.
I'll have set up a git repository, which I update after each Day is done. After the Advent of … is done, I'll publish the repo on GitHub.
Day 1 for both was basic. Let's see how the other days will be. I'm looking forward to that, they will be challenging, and I will learn a ton of new stuff.
I've compiled a list of names where companies and clients spelled my last name wrong in my past freelance carrier.
Brueggemannmann
Bruggemann
Brügggemann
Brüggeman
Brügemann
It's funny because you have to live with this name while the project is going on. To fix it, they have to delete your account and redo the account creation. Which typically takes 1–3 days or weeks. This depends on the company.
First, you need to get your hands dirty by just using what you are trying to learn, without any theory lessons. After you got some experience, take some lessons, and you have a more profound understanding of the theory with practical experience.
It sounds stupid and a waste of time. But this is how I learned since I can remember. Pure theory isn't helping, typically, for me. Furthermore, theory with practical examples is not working best. It is working while you are doing it, but I forget a lot of stuff this way when I don't practice the learned much.
My typical way of learning something new is to face the problem, trying to solve it with my general knowledge. I learn the hard way how something works and read afterward how it actually should be or how it was intended to be.
For example, as I learned python, I came with my PHP+JavaScript knowledge and tried to pull this knowledge over to python. With force. Finally, it was stupid, in my PHP (XAMPP and ready-to-go hosted server) and JavaScript (Browser) world, you just put a file via FTP somewhere and it worked magically. In python, you need to start a server with WSGI support. This was new for me at the time. This is something I will always remember because, unaware of it, I did practice-driven learning. :D