Skip to content

Latest commit

 

History

History

2016

Advent of Code 2016

Learning Dart by working my way through Advent of Code 2016 (in March 2022).

Table of Contents

Instructions

Installed Dart 2.16.1 via homebrew.

Run

  • VSCode: F5
  • Terminal dart run [path-to-file]

Test

Dart Notes

Todo

Daily Impressions

Comparing solutions against https://github.com/julemand101/AdventOfCode2016/tree/master/bin

Fairly straightforward problem. This is my first time using Dart so I have been looking up modules and syntax as I worked through the problem. Dart does not have native Tuple support; tried a Google implementation but it was not right.

The .toString method does make life easy if we have to hash small arrays (which we treat as tuples) inside of a Set. TIL: We can use the Point class to represent 2D positions.

Used Point and Map to build a key-value data structure for all the values in the Number Pad. Still trying to find a good way to organize Dart scripts. I think my template will be more helpful tomorrow than it was today.

Had to reach into the RegEx toolbox today to parse the puzzle data. Dart arrow functions are used to define a single expression. When using functional programming functions (map, reduce, and forEach), we have to use the regular function syntax to pass in functions.

Converting my input data into Objects and used straight forward OOP to solve this problem. Need to do some research into how lightweight Dart classes are, but I can see this being a powerful way to handle JSON-like data.

I can start to see how Dart is a powerful language -- it's syntax gets out of the way letting you get classes up and running really quickly.

Day 4 TIL

  • Regex non-capturing groups start with ?:
  • final keyword in Dart is similar to how we use const in ES6 and TS
  • Dart OOP -- creating classes, getters, setters, etc

Today was a brute-force problem that used the MD5 algorithm (via Dart's crypto package) to calculate a hash. It took around 50 seconds for each of my solutions to run.

Once I learn Flutter, this will be a fun one to animate.

A simple counting puzzle. 2016 is pretty straightforward so far.

Lots of text manipulation in this puzzle. Wrote a function to process each line and then I solved this problem in a fairly functional way.

This was took a bit longer than expected. Used a very Object-Oriented solution, but got wires mixed up with rows / columns vs y / x. Really liking Dart; can't seem to find anything about naming function parameters... but I need to do a bit more research.