This repository contains my solutions for Advent of Code.
Day | Part 1 ⭐ | Part 2 ⭐ | Solutions | Notes |
---|---|---|---|---|
1 | ⭐ | ⭐ | Solution | Great day! |
2 | ||||
3 | ||||
4 | ||||
5 | ||||
6 | ||||
7 | ||||
8 | ||||
9 | ||||
10 | ||||
11 | ||||
12 | ||||
13 | ||||
14 | ||||
15 | ||||
16 | ||||
17 | ||||
18 | ||||
19 | ||||
20 | ||||
21 | ||||
22 | ||||
23 | ||||
24 | ||||
25 |
Total Stars: 🌟 0 / 50
root
|__fetch.py
|__run.py
|__requirements.txt
|__solutions
|__day_<01..25>
|__input.txt
|__solution.py
|__test_solution.py
|____init__.py
pip install -r requirements.txt
source venv/bin/activate # On macOS/Linux
venv\Scripts\activate # On Windows
Add your session cookie from the Advent of Code website to a .env file:
AOC_SESSION=<your-session-cookie>
YEAR=<optional-fallback-to-current-year>
Use fetch.py
to download the puzzle input for a specific day.
Run fetch.py
:
python fetch.py <day>
Replace with the day number (e.g., 1 for Day 1).
The script will:
- Fetch the input for the specified day.
- Save it to
solutions/day_<day>/input.txt
.
Use run.py
to execute solutions for a specific day and replace with the day number:
python run.py <day>
The script will:
- Import the part1 and part2 functions from
solutions/day_<day>/solution.py
. - Read the input.txt file for that day.
- Run tests for that day.
- Print the results for both parts.
Each day includes unit tests to verify the solutions for both parts.
Run All Tests:
python -m unittest discover -s solutions -p "test_*.py"`
Run Tests for a Specific Day:
python -m unittest solutions/day_01/test_solution.py