Skip to content

Latest commit

 

History

History
105 lines (79 loc) · 2.25 KB

File metadata and controls

105 lines (79 loc) · 2.25 KB

🛠️ Setup & Usage Guide

This repository contains Advent of Code solutions in Python, Rust, and occasionally C++. Below you will find instructions on how to set up your environment and run the solutions.

🐍 Python

Prerequisites

Running a Solution

Navigate to the specific day's directory and run:

# Standard Python
python solution.py

# Using PyPy
pypy solution.py

🦀 Rust (2025+)

Starting from 2025, the project uses a Cargo Workspace structure.

Prerequisites

Setup

  1. Navigate to the 2025 directory:
    cd 2025
  2. Create a new day (bootstraps files):
    python3 new_day.py <day_number>
    # Example: python3 new_day.py 5

Running Solutions

You can run solutions directly from the 2025 root using the package name (dayXX).

# Debug Mode (slower, better error checks)
cargo run -p day01

# Release Mode (fast!)
cargo run --release -p day01

# Benchmarking
cargo bench -p day01

Legacy Rust (Pre-2025)

For older years (e.g., 2022), navigate to the year folder and run:

cd 2022
cargo run --release --bin day01

⚡ C++

Used mainly in 2018.

Building

  1. Navigate to the year folder:
    cd 2018
  2. Generate build files:
    mkdir build && cd build && cmake ..
  3. Compile:
    make day01 && cmake --install day01
  4. Run:
    cd install/day01 && ./day01

📥 Fetching Inputs automatically

This template uses advent-of-code-data to automatically fetch your puzzle inputs.

  1. Install the tool:

    pip install advent-of-code-data
  2. Authentication:

    • Log in to Advent of Code in your browser.
    • Find your session cookie (F12 -> Application -> Cookies).
    • Create a .env file in the 2025 directory (or root).
    • Add: AOC_SESSION=your_copied_cookie_value
  3. Usage: When you run python3 new_day.py, it will automatically download input.txt.