Articles tagged #rust
Day 7 (Advent of Code 2020)
Another day, another Advent of Code 2020 problem.
That one seems fun! For some nerdy values of fun.
Our input is a set of rules:
light red bags contain 1 bright white bag, 2 muted yellow bags.
dark orange bags contain 3 bright white bags, 4 muted yellow bags.
bright white bags contain 1 shiny gold bag.
muted yellow bags contain 2 shiny gold bags, 9 faded blue bags.
shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags.
dark olive bags contain 3 faded blue bags, 4 dotted black bags.
vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.
faded blue bags contain no other bags.
dotted black bags contain no other bags.
Day 6 (Advent of Code 2020)
The end of Advent of Code 2020 is fast approaching, and we’re nowhere near done. Time to do Day 6!
The problem statement here is a little contrived, as uh, as the days that came before it, but that won’t stop us.
Basically, the input looks like this:
abc
a
b
c
ab
ac
a
a
a
a
b
Each line represents one person, and “groups of persons” are separated by blank lines.
Day 5 (Advent of Code 2020)
Time for another day of Advent of Code 2020.
For Day 5, we’re going to have to do…
Let me guess: more parsing?
Correct!
So there’s an airline that uses binary space partitioning when referring to seats - there’s 128 rows and 8 columns. The first 7 characters are either F (Front, for the lower half) and B (back, for the upper half), and the last 3 are L (Left, for the lower half) or R (Right, for the upper half).
Day 4 (Advent of Code 2020)
It’s time for Day 4 of the Advent of Code 2020!
Now, I’ve already had a look at the problem statement, at least for part 1, and I’m not particularly excited.
But it will allow me to underline some of the points I’ve recently been *trying to make about types and correctness.
Ah, yes, the novel.
The problem is to parse passports, with fields like these:
Day 3 (Advent of Code 2020)
Hello all, and welcome back to Advent of Code 2020, featuring Cool Bear.
Hey y’all!
Let’s get right to it.
The problem statement for Day 3 is as follows: we’re given a map, that looks like this:
..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
.#..#...#.#
And we imagine that it repeats infinitely to the right, like so:
Day 2 (Advent of Code 2020)
Day 2, Day 2! Woo!
The Advent of Code 2020, Day 2 problem talks about passwords. Sounds familiar.
Basically, our input looks like this:
1-3 a: abcde
1-3 b: cdefg
2-9 c: ccccccccc
Each line contains a “password policy” and a “password”. For the first line, the policy is that the password must contain between 1 and 3 (inclusive) times the letter “a”.
Day 1 (Advent of Code 2020)
I was not planning on doing anything specific this December, but a lot of folks around me (on Twitter, at work) have chosen this Advent of Code to pick up Rust, and I’ve got big FOMO energy, so, let’s see where this goes.
I’ll be doing all of these on Linux, so there may be some command-line tools involved, but don’t worry about them - the code itself should run on all platforms no problem.
Go back to the homepage.