Advent of Code Day #6

Day 6 is again pretty nice to solve with Ruby. Today it is all about customs declaration. We again have different groups seperated by a newline containing multiple lines with characters. Each line represents a person and each character represents a different question answered with “yes”. abc a b c ab ac a a a a In this example we do have four groups of people. The first group only has one person which answered three questions....

December 6, 2020 · 2 min · 328 words · Robert

Advent of Code Day #5

Day five is all about the airplane seating. One seat it represented by something like this: FBFBBFFRLR. The first eight characters are for the row, the last three for the seat. Part 1 We need to find the highest seat id to solve the first part. The seat id is calculated with: row-id * 8 + column. For the rows you start with a range of 0 to 127. F means use the first half B means use the last half With this in mind you need to iterate over the first eight characters to get your seat....

December 5, 2020 · 2 min · 263 words · Robert

Advent of Code Day #4

In day 4 we need to deal with passports (yay!) and check if they are valid for given criterias. The passworts do have multiple fields (key:value) and are divided by a newline. ecl:gry pid:860033327 eyr:2020 hcl:#fffffd byr:1937 iyr:2017 cid:147 hgt:183cm iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 hcl:#cfa07d byr:1929 hcl:#ae17e1 iyr:2013 eyr:2024 ecl:brn pid:760753108 byr:1931 hgt:179cm The fields are given and expected like so: byr (Birth Year) iyr (Issue Year) eyr (Expiration Year) hgt (Height) hcl (Hair Color) ecl (Eye Color) pid (Passport ID) cid (Country ID) Splitting them into “passports” is as easy as it gets....

December 4, 2020 · 2 min · 255 words · Robert

Advent of Code Day #3

In day 3 you have a ever repeating map with trees and free spaces. You move over this map and have to count how many trees (#) you will hit. Part 1 Given is a pattern in which you move right and down. In part 1 we start in the top left corner and always move 3 right and one down until we reach the last line. ..##.........##.........##.........##.........##.........##....... ---> #...#...#..#...#...#..#...#...#..#...#...#..#...#...#..#...#...#.. ....

December 3, 2020 · 2 min · 282 words · Robert

Advent of Code Day #2

In day 2 you were given a set of rules to be parsed first. The looked like this: 1-3 a: abcde 1-3 b: cdefg 2-9 c: ccccccccc Each line contains two numbers, a character and a password Part 1 In part 1 you have to check if the given character appears at least and at most times given by the numbers. Each password that matches this behavior is considered valid....

December 2, 2020 · 1 min · 95 words · Robert