Skip to content

Advent of Code 2024

Notifications You must be signed in to change notification settings

chris-spann/aoc_2024

Repository files navigation

Advent of Code 2024 🎄✨

Welcome to Advent of Code 2024! This repository contains my solutions to the daily programming challenges hosted on Advent of Code.

pre-commit.ci status

📊 Progress

Day Part 1 Part 2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

🚀 Project Setup

This project is written in Python and uses Poetry for dependency management. It also includes a Makefile to simplify common tasks like testing, linting, and running solutions.

Prerequisites

Ensure the following are installed:

  • Python 3.11+
  • Poetry
  • Make (optional but recommended for automation)

🛠 Installation and Setup

  1. Clone the repository:

    git clone https://github.com/chris-spann/aoc_2024.git
    cd aoc_2024
  2. Install dependencies:

    poetry install
  3. Activate the virtual environment:

    poetry shell

📜 Usage

Running Solutions

Each day’s solution can be run using a Makefile command or directly via Python.

Option 1: Using Make

Run the solution for a specific day:

make run_day day=1

Replace 1 with the desired day number.

Option 2: Using Python

Run the solution directly:

poetry run python -m solutions.day_1

🛠 Makefile Commands

This project includes a Makefile with the following commands:

Command Description
make test Run the test suite using pytest.
make lint Run code linting and autofix issues with ruff.
make format Auto-format the codebase using ruff.
make typecheck Typechecking with pyright.
make generate_day Generate boilerplate code for a new day.
make run_day day=X Run the solution for a specific day.
make update_progress Update progress in README.md

Generating a New Day's Solution

To generate boilerplate for a new day:

make generate_day

This runs the utils/generate_day.py script to create the necessary files.

Progress Updates

This project utilizes a pre-commit hook to update the Progress section of this readme that is triggered by a commit pushed with message Completed Day {puzzle_day_number} Part {part}.


🧪 Testing and Linting

Run Tests

Tests are written using pytest. Run them with:

make test

Lint and Fix Code

Use ruff to lint and fix issues:

make lint

Format the code:

make format

🌟 Contributions

Feel free to fork this repository, open issues, or submit pull requests if you have ideas or improvements. Happy coding! 🎄✨


About

Advent of Code 2024

Resources

Stars

Watchers

Forks