Using a modified boilerplate: ts-jest-boilerplate.
First, install dependencies with yarn
.
AoC is a great way to practice Test Driven Development. To start a puzzle, copy the small test case from the question, and the given input file, using any of the previous days as an example. Develop using yarn test:watch
. When your given test case passes, your input file's test case may have a solution (its test will fail, showing you the answer as "received" input). If the larger input fails while your small input passes, you're missing some edge cases, which should be added as additional tests!
Day 1
Pretty straight forward iteration. This is one of the few that I'll try at midnight, so went for what was fast on the second part, likely some cleanup available there. Definitely handy to have some utils ready and running Jest in watch mode spits out the right answer as "received".
Day 2
Got a little confused on the second part, thinking that up/down should still do their old job plus adjust the aim.