This was a busy week and I was unable to make a single post throughout the week. This however, does not mean I have abandoned AoC. I will try to catch up but I should mention that finishing everyday was not the goal to begin with, the goal for me is to learn Pharo while doing as many puzzles as I can. Part 1 Sample input for part 1 is : ...
Advent of Code 2023 Using Pharo Smalltalk Day 2
Yesterday’s solution already looks facepalm worthy even though its been only 24 hours since. Hopefully today’s parsing code will be better. Let’s do this. Day 2 - Part 1 Sample input for the first part is : Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green The games are numbered and each game has multiple sets separated by ; with colored cubes taken from a bag. The condition is that maximum 12 red, 13 green and 14 blue cubes are allowed. So if any set in a game exceeds this limit, the game becomes invalid. We have to calculate the sum of id’s of valid games. With the sample input, games 3 (20 red) and 4 (15 blue) are rejected and sum of id’s of the remaining games is 8. ...
Advent of Code 2023 Using Pharo Smalltalk Day 1
I will do this year’s Advent of Code challeges in Pharo Smalltalk. Let’s see how far I can go with it. Day 1 - Part 1 Here is the sample input for the first part of the puzzle: 1abc2 pqr3stu8vwx a1b2c3d4e5f treb7uchet Our task here is to extract the first digit and the last digit to form a single two digit number. For the four sample lines, these numbers will be 12, 38, 15, and 77. The answer to the puzzle is the sum of all these numbers, 142 in this case. ...