mike's website

embedded, robots, rust

<<<

i am doing advent of code in rust

Prelude

This is the first post in a series of (hopefully 50!) posts. I am going to use the Advent of Code as my “homework” for learning the systems programming language Rust. Advent of Code is a thing that some smart people do every year where they come up with a series of clever puzzles and then release them every day for 25 days, starting on December 1.

They do this every year, so I’m going to start with 2022, since all the solutions are known and there’s a lot of discussion about them, which should provide ample ground for hints if I get stuck.

What’s my goal here?

One of my goals in 2023 is to learn the systems programming language Rust. I’ve finally been convinced by you crab people Rust evangelists of its utility, and I can see that the language has some staying power. I recently got hired as a programmer here in San Diego; I’m working primarily in C on a fairly complex embedded codebase, which has certainly been fun and interesting so far!

I would like to continue programming as a hobby and to build some more general computer science skills outside of work, though, so I aim to work slowly through Advent of Code this year where I have time. I want to do 6-8 hours of programming and writing per week on this project. If I spent 6-8 hours per week at the gym this year, I would be in good shape by the end of the year; so if I do this for 6-8 hours a week, I’ll be in shape at communication and at programming, and at Rust.

I have a few goals:

  1. Learn the Rust programming language.
  2. Be good at data structures and algorithms fundamentals.
  3. Be good at communicating a technical process. Understanding the problem, whiteboarding/brainstorming, roadblocks, and solutions.
  4. Make a journal of my solving these problems so that later I can look back on how obvious and easy they are and how dumb I used to be!
  5. Have some fun and practice writing.

How this series will look

There’s going to be a few common sections.

The first section is the problem description. If I don’t have any trouble understanding my task here, I will probably just link the AoC problem. If the problem is particularly thorny or I need to write it down to fully internalize it, I will write it down in this section.

The next section will be the initial approach: here, I will describe in pseudocode my white-board thoughts on how I will approach the problem, along with any algorithm notes. I haven’t formally studied algorithms & datastructures, so this is the place where I’m doing my “homework.” I think this will really help me build the hard “computer science” communication and problem solving skills that are commonly tested in e.g. technical interviews. I know these problems are tricky in general, so this should be good homework.

I will try to break the problem down to pieces and explain each piece. If I’m stuck, I might try to get a hint to the problem or view the solution.

If I get sick of whiteboarding, I’ll probably dive into the code for some of the sections I understand.

Then, we’ll get to implementation. Here I want to walk through what I did to solve the problem. What did I learn? What things were unexpected or surprising? Where did I get the solution from?

Finally, the last section will be notes and reflections about the process.

Go to day 1