/aoc2022

Advent of Code 2022 in TypeScript

Primary LanguageTypeScript

🧑‍🎄 Advent of Code 2️⃣0️⃣2️⃣2️⃣ (Typescript) 🧑‍🎄

Repository to keep solutions for Advent of Code 2022 edition. this time I decided to take it in Typescript.

Santa's reindeer typically eat regular reindeer food, but they need a lot of magical energy to deliver presents on Christmas. For that, their favorite snack is a special type of star fruit that only grows deep in the jungle. The Elves have brought you on their annual expedition to the grove where the fruit grows.

To supply enough magical energy, the expedition needs to retrieve a minimum of fifty ⭐s by December 25th. Although the Elves assure you that the grove has plenty of fruit, you decide to grab any fruit you see along the way, just in case.

Collect ⭐s by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one ⭐. Good luck!

🎄 Results 🎄

⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐ 💮💮 💮💮 💮💮 💮💮 💮💮 💮💮 💮💮 💮💮 💮💮 💮💮

preview

Tasks ✅

Task Execution time Result Complexity (1-3)
Day 01 (4,737 rps) / (4,998 rps) ⭐ / ⭐ 1️⃣ / 1️⃣
Day 02 (2,174 rps) / (2,155 rps) ⭐ / ⭐ 1️⃣ / 1️⃣
Day 03 (3,831 rps) / (1,639 rps) ⭐ / ⭐ 1️⃣ / 1️⃣
Day 04 (2,083 rps) / (2,065 rps) ⭐ / ⭐ 1️⃣ / 1️⃣
Day 05 (6,087 rps) / (5,574 rps) ⭐ / ⭐ 1️⃣ / 1️⃣
Day 06 (15,840 rps) / (858 rps) ⭐ / ⭐ 1️⃣ / 1️⃣
Day 07 (5,033 rps) / (4,422 rps) ⭐ / ⭐ 1️⃣ / 1️⃣
Day 08 Need to be optimized ;) ⭐ / ⭐ 1️⃣ / 2️⃣
Day 09 (618 rps) / (412 rps) as well ⭐ / ⭐ 2️⃣ / 2️⃣
Day 10 (23 422 rps) / (20966 rps) ⭐ / ⭐ 1️⃣ / 1️⃣
Day 11 (8847 rps) / (LOL) ⭐ / ⭐ 1️⃣ / 1️⃣
Day 12 (170 rps) / (163 rps) ⭐ / ⭐ 1️⃣ / 1️⃣
Day 13 (1,877 rps) / (772 rps) ⭐ / ⭐ 1️⃣ / 1️⃣
Day 14 (---) / (---) ⭐ / ⭐ 1️⃣ / 1️⃣
Day 15 (---) / (---) ⭐ / ⭐ 1️⃣ / 2️⃣

🛠 Usage 🛠

Use correct node version ♻️

nvm use

Install dependencies 💰

npm install

Run 🚀

Run scripts are named by days they are bound to:

To run Day 01 scripts and log their responses, just type:

npm run 01

Tests 🛃

To run tests:

npm run test

Benchmarks 📊

Benchmarks are also in package.json, tu run benchmark, just use number of day with -benchmark after, for example:

npm run 4-benchmark

Very often advanced scripts are using basic scripts to not repeat myself, so You can get multiple results.

📂 Structure 📂

  • Tasks are grouped in directories with number of day and in files named by complexity, so day 1 will be directory 01 with two files underneath basic.ts and advanced.ts
  • There will be also input.txt file in each directory
  • Utils scripts will be placed in utils directory
  • Benchmarks for everyday solutions together (basic + advanced)
  • 📘 src/${day} or utils - implementations
  • 📔 assets - various images, mainly
  • 📗 src/__tests__ - tests for tasks
  • 📖 benchmarks - tasks benchmarks, one suite can have multiple benchmarks when there is more implementations for one task provided

🧙 Wants more? 🧙

Check out my colleagues repositories, who are also taking part in this year AoC.

🧑‍🍳 Author 🧑‍🍳

Authored completely by Michal "Lidjan" Nicinski @minidmnv