Episode: 3744 Title: HPR3744: Advent of code Day 1 - 4 Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3744/hpr3744.mp3 Transcribed: 2025-10-25 04:51:55 --- This is Hacker Public Radio Episode 3,744 for Thursday the 8th of December 2022. Today's show is entitled, Advent of Code Day 1-4. It is hosted by Daniel Person and is about 5 minutes long. It carries a clean flag. The summary is, talking about my experience of advent of code so far. Hello Hacker, today I'm going to talk about Advent of Code and to make a short story much longer, I would actually say that I wanted to do this in January this year because last year I did all the advent of code puzzles and were able to actually solve all of them, which I was really proud of, so my thought was that I should actually do that and talk about all of them and do a bunch of episodes, but then January came, a lot of sickness and a lot of the personal issues, so I couldn't really handle actually recording anything. And now a year has gone and I've started with Advent of Code again and as we should do one episode a year, if I don't do an episode soon, then Ken would be really angry. Now I'm just kidding, or do I? Well, I'm going to talk about this year's Advent of Code and we have done four days so far and day one was really simple. It was calculating the number of calories that each elf were carrying, so they have separated the calorie listings by an empty line and then you had to count them together and figure out who had the most calories and then you had to find top three and add those together. So a pretty simple thing, but if you're doing it in a totally new language, that could be a great challenge to start with. Day two was a huge rock paper scissors challenge, also not that hard and I were really focused on actually setting all into different variables and describing everything. So I have variables for rock paper and scissors, for a loss, a draw and a win and I'm trying to keep everything as readable as possible. And the first thing was just to see how many, how much of score, the score would be if we just follow a specific schedule and then we had another competition where we actually were trying to figure out what we should do in order to win, draw or lose on each of these different things. So it's an interesting challenge, not super hard. Then day three is actually hardest so far. It were a bunch of lines with text and you just had a bunch of characters and you had to figure out if you split the line in two, you have to figure out what is the unique things on each line or which things are repeating on both sides of the line if you split them in two. And then you had to figure out in the second part what things are actually there in all three or three lines and I saw that in a totally new way for me, I actually were able to solve it by having lists of numbers and then those lists I put into a set. So the set of numbers I got all the unique numbers of the alphabet. So all the characters had a specific number in the alphabet and I put them into a set. So I had only unique ones and then there is a function called retain all that's pretty much does an intersection between two sets. So I could do that on all three lines, do the intersection of them and actually go get what things were the things contained in all of the lines. So that was a new thing for me and I actually learned something in day three so I was really pleased with that one and last but not least day four we had a bunch of ranges. So this where the elves could clean the camp and they had different sections or areas that they wanted to clean and we needed to figure out which areas or numbers of areas that actually were overlapping each other and first a puzzle was finding all the ones of our totally overlapping so one else would do everything that the other elves should do and then the second part we needed to figure out which overlap at all. So not as I thought first that day we should find those that didn't overlap at all. So what I implemented was things that had no overlap and then I just subtracted that with all of them and I got all the ones that overlap in any way. So these are the first four days I really enjoy Advent of Code so far as I do every year and I create small recordings on YouTube so you can go there and see those if you want. I will keep put some links in the talking points for this episode and I hope that you found this interesting and I hope that you are also doing Advent of Code and if so, record an episode and talk about your experience with Advent of Code. If you have never done Advent of Code before and you have any coding experience or for that matter no coding experience, pick it up, take any of these first puzzles and take a programming language and read up on it. You could solve the first four if you have no knowledge, if you just put some time into it and to all of you to the next time use open source software. You have been listening to Hacker Public Radio at HackerPublicRadio.org. Today's show was contributed by a HBR listener like yourself. If you ever thought of recording a podcast and click on our contribute link to find out how easy it really is. Posting for HBR has been kindly provided by an onsthost.com, the internet archive and rsync.net. On this otherwise stated, today's show is released under Creative Commons Attribution 4.0 International License.