adventofcode 25.4__tar.gz → 25.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {adventofcode-25.4 → adventofcode-25.6}/CHANGELOG.md +12 -0
- {adventofcode-25.4 → adventofcode-25.6}/PKG-INFO +83 -54
- adventofcode-25.6/README.md +205 -0
- adventofcode-25.6/src/adventofcode/__about__.py +1 -0
- adventofcode-25.4/README.md +0 -176
- adventofcode-25.4/src/adventofcode/__about__.py +0 -1
- {adventofcode-25.4 → adventofcode-25.6}/.github/workflows/publish.yml +0 -0
- {adventofcode-25.4 → adventofcode-25.6}/.gitignore +0 -0
- {adventofcode-25.4 → adventofcode-25.6}/.pre-commit-config.yaml +0 -0
- {adventofcode-25.4 → adventofcode-25.6}/LICENSE +0 -0
- {adventofcode-25.4 → adventofcode-25.6}/pyproject.toml +0 -0
- {adventofcode-25.4 → adventofcode-25.6}/src/__init__.py +0 -0
- {adventofcode-25.4 → adventofcode-25.6}/src/adventofcode/__init__.py +0 -0
- {adventofcode-25.4 → adventofcode-25.6}/src/adventofcode/cli.py +0 -0
- {adventofcode-25.4 → adventofcode-25.6}/src/adventofcode/utils.py +0 -0
- {adventofcode-25.4 → adventofcode-25.6}/tests/__init__.py +0 -0
- {adventofcode-25.4 → adventofcode-25.6}/tests/test_adventofcode.py +0 -0
|
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Calendar Versioning](https://calver.org).
|
|
7
7
|
|
|
8
|
+
## [25.6]
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
* Image issue in README
|
|
13
|
+
|
|
14
|
+
## [25.5]
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
* Readme improvements
|
|
19
|
+
|
|
8
20
|
## [25.4]
|
|
9
21
|
|
|
10
22
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: adventofcode
|
|
3
|
-
Version: 25.
|
|
3
|
+
Version: 25.6
|
|
4
4
|
Summary: Helper utilities for solving Advent of Code puzzles
|
|
5
5
|
Project-URL: Documentation, https://github.com/anze3db/adventofcode#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/anze3db/adventofcode/issues
|
|
@@ -27,19 +27,37 @@ Requires-Dist: requests
|
|
|
27
27
|
Requires-Dist: rich
|
|
28
28
|
Description-Content-Type: text/markdown
|
|
29
29
|
|
|
30
|
-
# adventofcode
|
|
30
|
+
# 🎄 adventofcode [](https://pypi.org/project/adventofcode) [](https://pypi.org/project/adventofcode)
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
<p align="center">
|
|
33
|
+
<img width="742" height="613" alt="Screenshot 2025-12-02 at 10 04 42" src="https://github.com/user-attachments/assets/77b711b3-c2a2-4719-8d8a-083af2067c62" />
|
|
34
|
+
</p>
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
### Your framework for solving [Advent Of Code](https://adventofcode.com) puzzles 🧩 and benchmarking solutions 🚀
|
|
38
|
+
|
|
39
|
+
* Project scaffolding with `uv run adventofcode init`.
|
|
40
|
+
* Assert and submit your solutions with `uv run adventofcode run`.
|
|
41
|
+
* Benchmark all your solutions with `uv run adventofcode benchmark`.
|
|
37
42
|
* No copy-pasting puzzle inputs or loading inputs from files.
|
|
38
|
-
* Submit the answer immediately when your code returns the result 🏅
|
|
43
|
+
* Submit the answer immediately when your code returns the result. 🏅
|
|
44
|
+
|
|
45
|
+
------
|
|
46
|
+
|
|
47
|
+
**Table of Contents**
|
|
48
|
+
|
|
49
|
+
- [Setup](#setup)
|
|
50
|
+
- [Session cookie](#session-cookie)
|
|
51
|
+
- [Run and submit your solution](#run-and-submit-your-solution)
|
|
52
|
+
- [Benchmark all your solutions](#benchmark-all-your-solutions)
|
|
53
|
+
- [Using AoC class](#using-aoc-class)
|
|
54
|
+
- [Happy solving 🎄](#happy-solving-)
|
|
55
|
+
- [Similar projects](#similar-projects)
|
|
39
56
|
|
|
40
|
-
## Usage
|
|
41
57
|
|
|
42
|
-
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Setup
|
|
43
61
|
|
|
44
62
|
```bash
|
|
45
63
|
uv init
|
|
@@ -98,23 +116,12 @@ def part2(inp: str) -> str | int | None:
|
|
|
98
116
|
return None
|
|
99
117
|
|
|
100
118
|
```
|
|
119
|
+
## Session cookie
|
|
101
120
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
uv run adventofcode run
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
This will:
|
|
121
|
+
Before we can run these files we need to set up your session cookie. You can find the session cookie by going to [adventofcode.com] in your browser. Make sure you are logged in, then open your browser's developer tools and navigate to Application → Storage → Cookies. Look for the cookie named `session` and copy its value.
|
|
109
122
|
|
|
110
|
-
* Run your `part1` function with the inputs provided in the `part1_asserts` iterable and compare them with the expected values. If the function's return value doesn't match the expected answer, the command will stop. *Hint*: Each puzzle usually contains example input and an expected answer—these make for great asserts!
|
|
111
|
-
* If all the `part1_asserts` pass, `part1` will be called with your puzzle input fetched from adventofcode.com using your session cookie.
|
|
112
|
-
* If `part1` returns a non-None value for your puzzle input, that value will be submitted to adventofcode.com as your part 1 answer using your session cookie. All answer submissions are cached, so each unique answer will only be submitted once.
|
|
113
|
-
* If your answer was correct the same process repeats for `part2`.
|
|
114
123
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
Add the [adventofcode.com](https://adventofcode.com) session cookie value to your `.env` file:
|
|
124
|
+
Then add the [adventofcode.com](https://adventofcode.com) session cookie value to your `.env` file:
|
|
118
125
|
|
|
119
126
|
```
|
|
120
127
|
# Set your Advent of Code session cookie below
|
|
@@ -131,10 +138,22 @@ or to your environment variables:
|
|
|
131
138
|
export AOC_SESSION="..."
|
|
132
139
|
```
|
|
133
140
|
|
|
134
|
-
|
|
135
|
-
> You can find the session cookie by going to adventofcode.com in your browser. Make sure you are logged in, then open your browser's developer tools and navigate to Application → Storage → Cookies. Look for the cookie named `session` and copy its value.
|
|
141
|
+
## Run and submit your solution
|
|
136
142
|
|
|
137
|
-
|
|
143
|
+
Implement your solution in `part1` and `part2` functions and run
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
uv run adventofcode run 01.py
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
This will:
|
|
150
|
+
|
|
151
|
+
* Run your day 1, `part1` function with the inputs provided in the `part1_asserts` iterable and compare them with the expected values. If the function's return value doesn't match the expected answer, the command will stop. *Hint*: Each puzzle usually contains example input and an expected answer—these make for great asserts!
|
|
152
|
+
* If all the `part1_asserts` pass, `part1` will be called with your puzzle input fetched from adventofcode.com using your session cookie.
|
|
153
|
+
* If `part1` returns a non-None value for your puzzle input, that value will be submitted to adventofcode.com as your part 1 answer using your session cookie. All answer submissions are cached, so each unique answer will only be submitted once.
|
|
154
|
+
* If your answer was correct the same process repeats for `part2`.
|
|
155
|
+
|
|
156
|
+
## Benchmark all your solutions
|
|
138
157
|
|
|
139
158
|
You can benchmark your solutions with
|
|
140
159
|
|
|
@@ -144,44 +163,51 @@ uv run adventofcode benchmark
|
|
|
144
163
|
|
|
145
164
|
This will run each day's solution and parse the timing results from the output. The results will be printed to the console as well as added to your README.md.
|
|
146
165
|
|
|
166
|
+
Example console output:
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
147
170
|
Example README:
|
|
148
171
|
|
|
172
|
+
<!-- BENCHMARK_RESULTS_START -->
|
|
149
173
|
| Day | Status | Part 1 Time | Part 2 Time | Total Time |
|
|
150
174
|
|:---:|:------:|------------:|------------:|-----------:|
|
|
151
|
-
| 01 | ✅ |
|
|
152
|
-
| 02 | ✅ |
|
|
153
|
-
| 03 | ✅ |
|
|
154
|
-
| 04 | ✅ |
|
|
155
|
-
| 05 | ✅ |
|
|
156
|
-
| 06 | ✅ | 3.
|
|
157
|
-
| 07 | ✅ |
|
|
158
|
-
| 08 | ✅ |
|
|
159
|
-
| 09 | ✅ |
|
|
160
|
-
| 10 | ✅ |
|
|
161
|
-
| 11 | ✅ |
|
|
162
|
-
| 12 | ✅ |
|
|
163
|
-
| 13 | ✅ |
|
|
164
|
-
| 14 | ✅ | 3.
|
|
165
|
-
| 15 | ✅ |
|
|
166
|
-
| 16 | ✅ |
|
|
167
|
-
| 17 | ✅ | 0.
|
|
168
|
-
| 18 | ✅ |
|
|
169
|
-
| 19 | ✅ | 9.
|
|
170
|
-
| 20 | ✅ |
|
|
171
|
-
| 21 | ✅ | 0.
|
|
172
|
-
| 22 | ✅ | 603.
|
|
173
|
-
| 23 | ✅ |
|
|
174
|
-
| 24 | ⚠️ |
|
|
175
|
-
| 25 | ✅ |
|
|
176
|
-
| **Total** | |
|
|
175
|
+
| 01 | ✅ | 0.28ms 🟢 | 0.41ms 🟢 | 0.69ms 🟢 |
|
|
176
|
+
| 02 | ✅ | 0.76ms 🟢 | 1.13ms 🟢 | 1.89ms 🟢 |
|
|
177
|
+
| 03 | ✅ | 0.15ms 🟢 | 0.33ms 🟢 | 0.48ms 🟢 |
|
|
178
|
+
| 04 | ✅ | 21.43ms 🟢 | 4.79ms 🟢 | 26.22ms 🟢 |
|
|
179
|
+
| 05 | ✅ | 1.95ms 🟢 | 3.51ms 🟢 | 5.46ms 🟢 |
|
|
180
|
+
| 06 | ✅ | 3.04ms 🟢 | 3.91s 🔴 | 3.91s 🔴 |
|
|
181
|
+
| 07 | ✅ | 30.58ms 🟢 | 1.01s 🔴 | 1.04s 🔴 |
|
|
182
|
+
| 08 | ✅ | 0.42ms 🟢 | 0.60ms 🟢 | 1.02ms 🟢 |
|
|
183
|
+
| 09 | ✅ | 5.75ms 🟢 | 1.01s 🔴 | 1.02s 🔴 |
|
|
184
|
+
| 10 | ✅ | 2.85ms 🟢 | 3.05ms 🟢 | 5.90ms 🟢 |
|
|
185
|
+
| 11 | ✅ | 0.97ms 🟢 | 37.60ms 🟢 | 38.57ms 🟢 |
|
|
186
|
+
| 12 | ✅ | 30.75ms 🟢 | 31.96ms 🟢 | 62.71ms 🟢 |
|
|
187
|
+
| 13 | ✅ | 108.79ms 🟡 | 342.44ms 🟡 | 451.23ms 🟡 |
|
|
188
|
+
| 14 | ✅ | 3.03ms 🟢 | 380.22ms 🟡 | 383.25ms 🟡 |
|
|
189
|
+
| 15 | ✅ | 2.28ms 🟢 | 4.71ms 🟢 | 6.99ms 🟢 |
|
|
190
|
+
| 16 | ✅ | 80.55ms 🟢 | 124.54ms 🟡 | 205.09ms 🟡 |
|
|
191
|
+
| 17 | ✅ | 0.02ms 🟢 | 19.99ms 🟢 | 20.01ms 🟢 |
|
|
192
|
+
| 18 | ✅ | 5.66ms 🟢 | 6.98s 🔴 | 6.99s 🔴 |
|
|
193
|
+
| 19 | ✅ | 9.05ms 🟢 | 99.83ms 🟢 | 108.88ms 🟡 |
|
|
194
|
+
| 20 | ✅ | 47.46s 🔴 | 4.28s 🔴 | 51.74s 🔴 |
|
|
195
|
+
| 21 | ✅ | 0.22ms 🟢 | 0.25ms 🟢 | 0.47ms 🟢 |
|
|
196
|
+
| 22 | ✅ | 603.65ms 🟡 | 1.87s 🔴 | 2.47s 🔴 |
|
|
197
|
+
| 23 | ✅ | 223.80ms 🟡 | 222.87ms 🟡 | 446.67ms 🟡 |
|
|
198
|
+
| 24 | ⚠️ | 0.94ms 🟢 | - | 0.94ms 🟢 |
|
|
199
|
+
| 25 | ✅ | 6.02ms 🟢 | - | 6.02ms 🟢 |
|
|
200
|
+
| **Total** | | 48.60s 🔴 | 20.34s 🔴 | 68.94s 🔴 |
|
|
177
201
|
|
|
178
202
|
Legend:
|
|
179
203
|
* 🟢 < 100ms
|
|
180
204
|
* 🟡 100ms - 1s
|
|
181
205
|
* 🔴 > 1s
|
|
206
|
+
<!-- BENCHMARK_RESULTS_END -->
|
|
182
207
|
|
|
208
|
+
## Using AoC class
|
|
183
209
|
|
|
184
|
-
|
|
210
|
+
Alternatively, you can build your own workflow using the lower level AoC class
|
|
185
211
|
|
|
186
212
|
```python
|
|
187
213
|
from adventofcode import AoC
|
|
@@ -199,7 +225,10 @@ aoc.print_p2() # prints the second part of the puzzle
|
|
|
199
225
|
aoc.submit_p2('part 2 answer') # submits the answer to the second part of the puzzle
|
|
200
226
|
```
|
|
201
227
|
|
|
202
|
-
|
|
203
228
|
### Happy solving 🎄
|
|
204
229
|
|
|
205
230
|
Enjoy and have fun!
|
|
231
|
+
|
|
232
|
+
### Similar projects
|
|
233
|
+
|
|
234
|
+
* [elf](https://pypi.org/project/elf/)
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# 🎄 adventofcode [](https://pypi.org/project/adventofcode) [](https://pypi.org/project/adventofcode)
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img width="742" height="613" alt="Screenshot 2025-12-02 at 10 04 42" src="https://github.com/user-attachments/assets/77b711b3-c2a2-4719-8d8a-083af2067c62" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Your framework for solving [Advent Of Code](https://adventofcode.com) puzzles 🧩 and benchmarking solutions 🚀
|
|
9
|
+
|
|
10
|
+
* Project scaffolding with `uv run adventofcode init`.
|
|
11
|
+
* Assert and submit your solutions with `uv run adventofcode run`.
|
|
12
|
+
* Benchmark all your solutions with `uv run adventofcode benchmark`.
|
|
13
|
+
* No copy-pasting puzzle inputs or loading inputs from files.
|
|
14
|
+
* Submit the answer immediately when your code returns the result. 🏅
|
|
15
|
+
|
|
16
|
+
------
|
|
17
|
+
|
|
18
|
+
**Table of Contents**
|
|
19
|
+
|
|
20
|
+
- [Setup](#setup)
|
|
21
|
+
- [Session cookie](#session-cookie)
|
|
22
|
+
- [Run and submit your solution](#run-and-submit-your-solution)
|
|
23
|
+
- [Benchmark all your solutions](#benchmark-all-your-solutions)
|
|
24
|
+
- [Using AoC class](#using-aoc-class)
|
|
25
|
+
- [Happy solving 🎄](#happy-solving-)
|
|
26
|
+
- [Similar projects](#similar-projects)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## Setup
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv init
|
|
35
|
+
uv add adventofcode
|
|
36
|
+
uv run adventofcode init
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
This will generate the scripts for each day:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
.
|
|
43
|
+
├── 01.py
|
|
44
|
+
├── 02.py
|
|
45
|
+
├── 03.py
|
|
46
|
+
├── 04.py
|
|
47
|
+
├── 05.py
|
|
48
|
+
├── 06.py
|
|
49
|
+
├── 07.py
|
|
50
|
+
├── 08.py
|
|
51
|
+
├── 09.py
|
|
52
|
+
├── 10.py
|
|
53
|
+
├── 11.py
|
|
54
|
+
├── 12.py
|
|
55
|
+
├── main.py
|
|
56
|
+
├── pyproject.toml
|
|
57
|
+
├── README.md
|
|
58
|
+
└── uv.lock
|
|
59
|
+
|
|
60
|
+
1 directory, 16 files
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
All the generated Python files look like this:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
"""🎄 Solution for Day 1 of Advent of Code 2025 🎄
|
|
67
|
+
|
|
68
|
+
Usage:
|
|
69
|
+
|
|
70
|
+
uv run adventofcode run 01.py
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
inp = """your input"""
|
|
74
|
+
part1_asserts = [
|
|
75
|
+
(inp, None),
|
|
76
|
+
]
|
|
77
|
+
part2_asserts = [
|
|
78
|
+
(inp, None),
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def part1(inp: str) -> str | int | None:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def part2(inp: str) -> str | int | None:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
## Session cookie
|
|
91
|
+
|
|
92
|
+
Before we can run these files we need to set up your session cookie. You can find the session cookie by going to [adventofcode.com] in your browser. Make sure you are logged in, then open your browser's developer tools and navigate to Application → Storage → Cookies. Look for the cookie named `session` and copy its value.
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
Then add the [adventofcode.com](https://adventofcode.com) session cookie value to your `.env` file:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
# Set your Advent of Code session cookie below
|
|
99
|
+
# You can find it in your browser's developer tools after logging in to adventofcode.com.
|
|
100
|
+
# The name of the cookie is `session`.
|
|
101
|
+
AOC_SESSION="YOUR_SESSION_COOKIE_HERE"
|
|
102
|
+
AOC_YEAR=2025
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
or to your environment variables:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
export AOC_SESSION="..."
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Run and submit your solution
|
|
113
|
+
|
|
114
|
+
Implement your solution in `part1` and `part2` functions and run
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
uv run adventofcode run 01.py
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
This will:
|
|
121
|
+
|
|
122
|
+
* Run your day 1, `part1` function with the inputs provided in the `part1_asserts` iterable and compare them with the expected values. If the function's return value doesn't match the expected answer, the command will stop. *Hint*: Each puzzle usually contains example input and an expected answer—these make for great asserts!
|
|
123
|
+
* If all the `part1_asserts` pass, `part1` will be called with your puzzle input fetched from adventofcode.com using your session cookie.
|
|
124
|
+
* If `part1` returns a non-None value for your puzzle input, that value will be submitted to adventofcode.com as your part 1 answer using your session cookie. All answer submissions are cached, so each unique answer will only be submitted once.
|
|
125
|
+
* If your answer was correct the same process repeats for `part2`.
|
|
126
|
+
|
|
127
|
+
## Benchmark all your solutions
|
|
128
|
+
|
|
129
|
+
You can benchmark your solutions with
|
|
130
|
+
|
|
131
|
+
```shell
|
|
132
|
+
uv run adventofcode benchmark
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This will run each day's solution and parse the timing results from the output. The results will be printed to the console as well as added to your README.md.
|
|
136
|
+
|
|
137
|
+
Example console output:
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
Example README:
|
|
142
|
+
|
|
143
|
+
<!-- BENCHMARK_RESULTS_START -->
|
|
144
|
+
| Day | Status | Part 1 Time | Part 2 Time | Total Time |
|
|
145
|
+
|:---:|:------:|------------:|------------:|-----------:|
|
|
146
|
+
| 01 | ✅ | 0.28ms 🟢 | 0.41ms 🟢 | 0.69ms 🟢 |
|
|
147
|
+
| 02 | ✅ | 0.76ms 🟢 | 1.13ms 🟢 | 1.89ms 🟢 |
|
|
148
|
+
| 03 | ✅ | 0.15ms 🟢 | 0.33ms 🟢 | 0.48ms 🟢 |
|
|
149
|
+
| 04 | ✅ | 21.43ms 🟢 | 4.79ms 🟢 | 26.22ms 🟢 |
|
|
150
|
+
| 05 | ✅ | 1.95ms 🟢 | 3.51ms 🟢 | 5.46ms 🟢 |
|
|
151
|
+
| 06 | ✅ | 3.04ms 🟢 | 3.91s 🔴 | 3.91s 🔴 |
|
|
152
|
+
| 07 | ✅ | 30.58ms 🟢 | 1.01s 🔴 | 1.04s 🔴 |
|
|
153
|
+
| 08 | ✅ | 0.42ms 🟢 | 0.60ms 🟢 | 1.02ms 🟢 |
|
|
154
|
+
| 09 | ✅ | 5.75ms 🟢 | 1.01s 🔴 | 1.02s 🔴 |
|
|
155
|
+
| 10 | ✅ | 2.85ms 🟢 | 3.05ms 🟢 | 5.90ms 🟢 |
|
|
156
|
+
| 11 | ✅ | 0.97ms 🟢 | 37.60ms 🟢 | 38.57ms 🟢 |
|
|
157
|
+
| 12 | ✅ | 30.75ms 🟢 | 31.96ms 🟢 | 62.71ms 🟢 |
|
|
158
|
+
| 13 | ✅ | 108.79ms 🟡 | 342.44ms 🟡 | 451.23ms 🟡 |
|
|
159
|
+
| 14 | ✅ | 3.03ms 🟢 | 380.22ms 🟡 | 383.25ms 🟡 |
|
|
160
|
+
| 15 | ✅ | 2.28ms 🟢 | 4.71ms 🟢 | 6.99ms 🟢 |
|
|
161
|
+
| 16 | ✅ | 80.55ms 🟢 | 124.54ms 🟡 | 205.09ms 🟡 |
|
|
162
|
+
| 17 | ✅ | 0.02ms 🟢 | 19.99ms 🟢 | 20.01ms 🟢 |
|
|
163
|
+
| 18 | ✅ | 5.66ms 🟢 | 6.98s 🔴 | 6.99s 🔴 |
|
|
164
|
+
| 19 | ✅ | 9.05ms 🟢 | 99.83ms 🟢 | 108.88ms 🟡 |
|
|
165
|
+
| 20 | ✅ | 47.46s 🔴 | 4.28s 🔴 | 51.74s 🔴 |
|
|
166
|
+
| 21 | ✅ | 0.22ms 🟢 | 0.25ms 🟢 | 0.47ms 🟢 |
|
|
167
|
+
| 22 | ✅ | 603.65ms 🟡 | 1.87s 🔴 | 2.47s 🔴 |
|
|
168
|
+
| 23 | ✅ | 223.80ms 🟡 | 222.87ms 🟡 | 446.67ms 🟡 |
|
|
169
|
+
| 24 | ⚠️ | 0.94ms 🟢 | - | 0.94ms 🟢 |
|
|
170
|
+
| 25 | ✅ | 6.02ms 🟢 | - | 6.02ms 🟢 |
|
|
171
|
+
| **Total** | | 48.60s 🔴 | 20.34s 🔴 | 68.94s 🔴 |
|
|
172
|
+
|
|
173
|
+
Legend:
|
|
174
|
+
* 🟢 < 100ms
|
|
175
|
+
* 🟡 100ms - 1s
|
|
176
|
+
* 🔴 > 1s
|
|
177
|
+
<!-- BENCHMARK_RESULTS_END -->
|
|
178
|
+
|
|
179
|
+
## Using AoC class
|
|
180
|
+
|
|
181
|
+
Alternatively, you can build your own workflow using the lower level AoC class
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
from adventofcode import AoC
|
|
185
|
+
|
|
186
|
+
aoc = AoC() # defaults to current year and parses the day from the filename (e.g. 01.py will be day 1)
|
|
187
|
+
|
|
188
|
+
aoc.print_p1() # prints the first part of the puzzle
|
|
189
|
+
inp = aoc.get_input() # returns the input as a string
|
|
190
|
+
# solve the puzzle here
|
|
191
|
+
...
|
|
192
|
+
aoc.submit_p1('part 1 answer') # submits the answer to the first part of the puzzle
|
|
193
|
+
aoc.print_p2() # prints the second part of the puzzle
|
|
194
|
+
# solve the puzzle here
|
|
195
|
+
...
|
|
196
|
+
aoc.submit_p2('part 2 answer') # submits the answer to the second part of the puzzle
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Happy solving 🎄
|
|
200
|
+
|
|
201
|
+
Enjoy and have fun!
|
|
202
|
+
|
|
203
|
+
### Similar projects
|
|
204
|
+
|
|
205
|
+
* [elf](https://pypi.org/project/elf/)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "25.6"
|
adventofcode-25.4/README.md
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
# adventofcode
|
|
2
|
-
|
|
3
|
-
Helper utilities for solving Advent of Code puzzles.
|
|
4
|
-
|
|
5
|
-
* Project scaffolding with `uv run adventofcode init`
|
|
6
|
-
* Assert and submit your solutions with `uv run adventofcode run`
|
|
7
|
-
* Benchmark all your solutions with `uv run adventofcode benchmark`
|
|
8
|
-
* No copy-pasting puzzle inputs or loading inputs from files.
|
|
9
|
-
* Submit the answer immediately when your code returns the result 🏅
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
### Setup
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
uv init
|
|
17
|
-
uv add adventofcode
|
|
18
|
-
uv run adventofcode init
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
This will generate the scripts for each day:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
.
|
|
25
|
-
├── 01.py
|
|
26
|
-
├── 02.py
|
|
27
|
-
├── 03.py
|
|
28
|
-
├── 04.py
|
|
29
|
-
├── 05.py
|
|
30
|
-
├── 06.py
|
|
31
|
-
├── 07.py
|
|
32
|
-
├── 08.py
|
|
33
|
-
├── 09.py
|
|
34
|
-
├── 10.py
|
|
35
|
-
├── 11.py
|
|
36
|
-
├── 12.py
|
|
37
|
-
├── main.py
|
|
38
|
-
├── pyproject.toml
|
|
39
|
-
├── README.md
|
|
40
|
-
└── uv.lock
|
|
41
|
-
|
|
42
|
-
1 directory, 16 files
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
All the generated Python files look like this:
|
|
46
|
-
|
|
47
|
-
```python
|
|
48
|
-
"""🎄 Solution for Day 1 of Advent of Code 2025 🎄
|
|
49
|
-
|
|
50
|
-
Usage:
|
|
51
|
-
|
|
52
|
-
uv run adventofcode run 01.py
|
|
53
|
-
"""
|
|
54
|
-
|
|
55
|
-
inp = """your input"""
|
|
56
|
-
part1_asserts = [
|
|
57
|
-
(inp, None),
|
|
58
|
-
]
|
|
59
|
-
part2_asserts = [
|
|
60
|
-
(inp, None),
|
|
61
|
-
]
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def part1(inp: str) -> str | int | None:
|
|
65
|
-
return None
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def part2(inp: str) -> str | int | None:
|
|
69
|
-
return None
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Implement your solution in `part1` and `part2` functions and run
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
uv run adventofcode run
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
This will:
|
|
80
|
-
|
|
81
|
-
* Run your `part1` function with the inputs provided in the `part1_asserts` iterable and compare them with the expected values. If the function's return value doesn't match the expected answer, the command will stop. *Hint*: Each puzzle usually contains example input and an expected answer—these make for great asserts!
|
|
82
|
-
* If all the `part1_asserts` pass, `part1` will be called with your puzzle input fetched from adventofcode.com using your session cookie.
|
|
83
|
-
* If `part1` returns a non-None value for your puzzle input, that value will be submitted to adventofcode.com as your part 1 answer using your session cookie. All answer submissions are cached, so each unique answer will only be submitted once.
|
|
84
|
-
* If your answer was correct the same process repeats for `part2`.
|
|
85
|
-
|
|
86
|
-
### Set your session cookie
|
|
87
|
-
|
|
88
|
-
Add the [adventofcode.com](https://adventofcode.com) session cookie value to your `.env` file:
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
# Set your Advent of Code session cookie below
|
|
92
|
-
# You can find it in your browser's developer tools after logging in to adventofcode.com.
|
|
93
|
-
# The name of the cookie is `session`.
|
|
94
|
-
AOC_SESSION="YOUR_SESSION_COOKIE_HERE"
|
|
95
|
-
AOC_YEAR=2025
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
or to your environment variables:
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
export AOC_SESSION="..."
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
> [!NOTE]
|
|
106
|
-
> You can find the session cookie by going to adventofcode.com in your browser. Make sure you are logged in, then open your browser's developer tools and navigate to Application → Storage → Cookies. Look for the cookie named `session` and copy its value.
|
|
107
|
-
|
|
108
|
-
### Benchmarks
|
|
109
|
-
|
|
110
|
-
You can benchmark your solutions with
|
|
111
|
-
|
|
112
|
-
```shell
|
|
113
|
-
uv run adventofcode benchmark
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
This will run each day's solution and parse the timing results from the output. The results will be printed to the console as well as added to your README.md.
|
|
117
|
-
|
|
118
|
-
Example README:
|
|
119
|
-
|
|
120
|
-
| Day | Status | Part 1 Time | Part 2 Time | Total Time |
|
|
121
|
-
|:---:|:------:|------------:|------------:|-----------:|
|
|
122
|
-
| 01 | ✅ | 2.1ms 🟢 | 0.6ms 🟢 | 2.6ms 🟢 |
|
|
123
|
-
| 02 | ✅ | 1.9ms 🟢 | 1.2ms 🟢 | 3.1ms 🟢 |
|
|
124
|
-
| 03 | ✅ | 1.5ms 🟢 | 0.5ms 🟢 | 2.0ms 🟢 |
|
|
125
|
-
| 04 | ✅ | 22.5ms 🟢 | 5.2ms 🟢 | 27.8ms 🟢 |
|
|
126
|
-
| 05 | ✅ | 3.6ms 🟢 | 4.1ms 🟢 | 7.7ms 🟢 |
|
|
127
|
-
| 06 | ✅ | 3.6ms 🟢 | 4.14s 🔴 | 4.14s 🔴 |
|
|
128
|
-
| 07 | ✅ | 33.8ms 🟢 | 1.07s 🔴 | 1.11s 🔴 |
|
|
129
|
-
| 08 | ✅ | 1.0ms 🟢 | 0.7ms 🟢 | 1.7ms 🟢 |
|
|
130
|
-
| 09 | ✅ | 6.3ms 🟢 | 1.08s 🔴 | 1.09s 🔴 |
|
|
131
|
-
| 10 | ✅ | 3.2ms 🟢 | 3.2ms 🟢 | 6.4ms 🟢 |
|
|
132
|
-
| 11 | ✅ | 1.7ms 🟢 | 45.0ms 🟢 | 46.7ms 🟢 |
|
|
133
|
-
| 12 | ✅ | 33.3ms 🟢 | 31.0ms 🟢 | 64.4ms 🟢 |
|
|
134
|
-
| 13 | ✅ | 118.1ms 🟡 | 360.8ms 🟡 | 478.9ms 🟡 |
|
|
135
|
-
| 14 | ✅ | 3.7ms 🟢 | 411.4ms 🟡 | 415.1ms 🟡 |
|
|
136
|
-
| 15 | ✅ | 3.5ms 🟢 | 5.0ms 🟢 | 8.4ms 🟢 |
|
|
137
|
-
| 16 | ✅ | 87.1ms 🟢 | 133.9ms 🟡 | 221.1ms 🟡 |
|
|
138
|
-
| 17 | ✅ | 0.7ms 🟢 | 21.0ms 🟢 | 21.7ms 🟢 |
|
|
139
|
-
| 18 | ✅ | 7.2ms 🟢 | 7.49s 🔴 | 7.50s 🔴 |
|
|
140
|
-
| 19 | ✅ | 9.7ms 🟢 | 111.7ms 🟡 | 121.4ms 🟡 |
|
|
141
|
-
| 20 | ✅ | 50.54s 🔴 | 4.46s 🔴 | 54.99s 🔴 |
|
|
142
|
-
| 21 | ✅ | 0.4ms 🟢 | 0.3ms 🟢 | 0.8ms 🟢 |
|
|
143
|
-
| 22 | ✅ | 603.7ms 🟡 | 1.90s 🔴 | 2.50s 🔴 |
|
|
144
|
-
| 23 | ✅ | 255.0ms 🟡 | 263.4ms 🟡 | 518.4ms 🟡 |
|
|
145
|
-
| 24 | ⚠️ | 1.4ms 🟢 | - | 1.4ms 🟢 |
|
|
146
|
-
| 25 | ✅ | 7.2ms 🟢 | - | 7.2ms 🟢 |
|
|
147
|
-
| **Total** | | 51.75s 🔴 | 21.53s 🔴 | 73.28s 🔴 |
|
|
148
|
-
|
|
149
|
-
Legend:
|
|
150
|
-
* 🟢 < 100ms
|
|
151
|
-
* 🟡 100ms - 1s
|
|
152
|
-
* 🔴 > 1s
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
### Alternatively, you can build your own workflow using the lower level AoC class
|
|
156
|
-
|
|
157
|
-
```python
|
|
158
|
-
from adventofcode import AoC
|
|
159
|
-
|
|
160
|
-
aoc = AoC() # defaults to current year and parses the day from the filename (e.g. 01.py will be day 1)
|
|
161
|
-
|
|
162
|
-
aoc.print_p1() # prints the first part of the puzzle
|
|
163
|
-
inp = aoc.get_input() # returns the input as a string
|
|
164
|
-
# solve the puzzle here
|
|
165
|
-
...
|
|
166
|
-
aoc.submit_p1('part 1 answer') # submits the answer to the first part of the puzzle
|
|
167
|
-
aoc.print_p2() # prints the second part of the puzzle
|
|
168
|
-
# solve the puzzle here
|
|
169
|
-
...
|
|
170
|
-
aoc.submit_p2('part 2 answer') # submits the answer to the second part of the puzzle
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
### Happy solving 🎄
|
|
175
|
-
|
|
176
|
-
Enjoy and have fun!
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "25.4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|