Learn and Practice Rust with Advent of Code

Rainer Stropek | @rstropek

What is AoC...



...and why should you care?

What is AoC?

  • A series of Christmas-themed coding puzzles
    • A new puzzle every day between Dec, 1st and Dec, 25th
    • By solving, you help to get Santa out of trouble
    • Puzzles start rather simple, become harder later in December
    • Puzzles focus on algorithmic and data structure-related problems
  • A speed coding contest
    • Puzzles are published at midnight EST (UTC-5)
    • Solve them as fast as possible to reach a top rank on the leaderboard
    • Setup private leaderboards for your community
  • A great opportunity to practice a new programming language (e.g. Rust)
    • AoC is completely language-agnostic
    • You can use Scratch or Excel if you want 😂
  • A lot of fun 😁

How does it work?

You start on a blank slate

  • You can tackle the puzzle of the day or any puzzle of past days
  • You can access puzzles of previous years to practice before Dec, 1st

The Puzzles

  • Puzzles embedded in a story about Santa Claus
  • Description contains examples with solutions that you can use for TDD
    • E.g. practice to build unit tests from them

The Puzzles

  • You can download your personal puzzle input from the AoC site

     
  • You need to parse the puzzle input properly
    • Sometimes simple CSVs, sometimes more complex
    • Great to practice file handling, RegEx (matches, capture groups 🔗), splitting strings into spans, etc.


       
    • Don't download input via code with frequent HTTP requests to not overload AoC servers
  • You need to process the input properly
    • Great for practicing iterators and generators

The Puzzles

  • Done? Type in your answer online...



     
  • And hopefully you will get your first...

But wait, you aren't done yet!

The Puzzles

  • You get a second puzzle to earn a second star
    • Typically, a slightly more difficult version of the original puzzle



  • Again, you get examples with solutions (TDD)...
    • and you are back to coding...
  • Great to practice refactoring

⭐⭐

Tips

Tips

  • What do you want to get out of AoC?
  • Want to get better in speed coding?
    • Make sure to get up early 😴⏰🔔
    • Quick and dirty is fine
  • Want to practice a new language?
    • Don't underestimate the additional effort as AoC challenges are sometimes hard
    • Code quality and idiomatic coding
  • Join a group that works on AoC
    • Having a fixed appointment makes it easier to stay on it
  • Prepare a project/workspace structure in the first few days
    • You will need it once the puzzle become harder
  • Prepare family that you will be coding on Dec 24th and 25th 🎄🤣

AoC and Communities in Linz

  • We participated in AoC 2020 with young coders at



     
  • Mentors and young coders meet daily and solve puzzles together
    • Two young coders made it to 50⭐in 2020 👏
  • Do you want to join?
    • Rust coders are very welcome
    • Work on your own solutions and help young coders overcome problems

Want to do AoC 2021 in Rust?

But you don't want to code alone?

Have fun with AoC!