Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/andrewbrennanfr/advent-of-code-2024

My (very ðŸĪŠ) opinionated TypeScript repository for Advent of Code 2024!
https://github.com/andrewbrennanfr/advent-of-code-2024

advent-of-code bun functional-programming typescript

Last synced: 3 days ago
JSON representation

My (very ðŸĪŠ) opinionated TypeScript repository for Advent of Code 2024!

Awesome Lists containing this project

README

        

# 🎄 Advent of Code 2024 🎄

Welcome to my **Advent of Code 2024** repository! Built with **TypeScript** and grounded in **functional programming**.

---

## ⚡ Why Bun?

This project uses **Bun**, a fast JavaScript runtime ideal for Advent of Code:

- **Tail Call Optimization (TCO)**: Enables deep recursion without stack overflow.
- **High Performance**: Optimized JIT for complex Advent of Code computations.
- **Built-In Test Runner**: Allows easy test setup and validation of solutions.
- **Native TypeScript Support**: Type-safe coding without extra compilation.

For more, visit [Bun's website](https://bun.sh/).

## ðŸ“Ķ Getting Started

1. **Clone the Repository:**

```sh
git clone https://github.com/andrewbrennanfr/advent-of-code-2024.git
cd advent-of-code-2024
```

2. **Install Dependencies:**

```sh
bun install
```

3. **Set Up Git Hooks (using Husky):**
```sh
bun husky
```

## 🚀 Key Scripts

- **`bun check`** – TypeScript type-checking.
- **`bun format`** – Code formatting with Prettier.
- **`bun lint`** – Linting with ESLint.
- **`bun new NN`** – Creates a new puzzle directory and starts tests.
- **`bun start`** – Runs all tests in watch mode.
- **`bun start NN`** – Runs tests in directory `NN` in watch mode.
- **`bun test`** – Runs all tests once.
- **`bun test NN`** – Runs tests in directory `NN` once.

---

## 🧠 Project Philosophy

### Functional Programming

Emphasizes pure functions, recursion, and higher-order functions for clear, maintainable solutions.

### Immutability

To reduce side effects, data is kept immutable by default, with mutations allowed only for `Map` and `Set` instances named with a `mutable` prefix (e.g., `mutableMap`, `mutableSet`).

> ⚠ïļ **Note**: Use mutable collections with caution due to potential side effects.

---

## 📁 Puzzle Inputs

Puzzle input files are excluded from version control per [Advent of Code's guidelines](https://adventofcode.com/2024/about).

---

## 📜 License

Licensed under the MIT License.

---

🎅 Happy solving!