|
1 | 1 | # adventofcode |
2 | 2 |
|
3 | | -My solutions to [Advent of Code](https://adventofcode.com/). |
| 3 | +My solutions to [Advent of Code](https://adventofcode.com). |
| 4 | + |
| 5 | +The solution template I use is a modified version of David Brownman's amazing |
| 6 | +[Python solution template](https://github.com/xavdid/advent-of-code-python-template). |
| 7 | +Python 3.12 or higher is required to run these solutions; if you want to run |
| 8 | +them yourself and are having trouble, let me know in [a GitHub issue](https://github.com/WinslowJosiah/adventofcode/issues) |
| 9 | +on this repo. |
| 10 | + |
| 11 | +In 2024, I wrote [blog posts](https://winslowjosiah.com/blog/category/advent-of-code) |
| 12 | +on my personal website explaining my solutions for each day. Starting in 2025, |
| 13 | +I've been rewriting my solutions to use their current template, and writing |
| 14 | +step-by-step explanations of them for use on a separate portion of my website: |
| 15 | +<https://aoc.winslowjosiah.com>. Check it out if you're interested! |
4 | 16 |
|
5 | 17 | ## Usage |
6 | 18 |
|
7 | | -To run a solution for a given year and day, run `aoc` with the following |
| 19 | +To run a solution for a given year and day, run `aoc.py` with the following |
8 | 20 | options: |
9 | 21 |
|
10 | | -| Short Option | Long Option | Parameter(s) | Explanation | |
11 | | -| ------------ | ------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
12 | | -| `-h` | `--help` | none | Show a help message and exit. | |
13 | | -| `-y` | `--year` | `n`, an integer | The year for which to run the solution. | |
14 | | -| `-d` | `--day` | `n`, an integer between `1` and `25` | The day for which to run the solution. | |
15 | | -| `-b` | `--benchmark` | `n`, a non-negative integer (default `100`) | The solution will be benchmarked; it will be run `n` times, then the time will be averaged and reported. (If the option is left out, the solution is not benchmarked.) | |
16 | | -| `-i` | `--input` | one or more filepaths | Each of the files specified by the paths will be passed as input to the solution. If the path is relative, it will be treated as relative to the directory of the solution. (If the option is left out, all files in the solution directory are used.) | |
| 22 | +| Short Option | Long Option | Parameter(s) | Explanation | |
| 23 | +| ------------ | ------------- | ------------------------------------------- | -------------------------------------------------------------------------------------- | |
| 24 | +| `-h` | `--help` | none | Show a help message and exit. | |
| 25 | +| `-y` | `--year` | `n`, an integer | The year for which to run the solution. | |
| 26 | +| `-d` | `--day` | `n`, an integer between `1` and `25` | The day for which to run the solution. | |
| 27 | +| `-t` | `--test` | none | If provided, use the test input instead of the full puzzle input. | |
| 28 | +| N/A | `--debug` | none | If provided, print things passed to `self.debug()` within the solution. | |
| 29 | +| `-b` | `--benchmark` | `n`, a non-negative integer (default `100`) | If provided, benchmark the solution by running it `n` times and averaging the runtime. | |
| 30 | +| `-s` | `--slow` | none | If provided, run solution functions marked as `@slow` (which aren't run by default). | |
| 31 | +| `-p` | `--profile` | none | If provided, profile the solution with `cProfile`. | |
17 | 32 |
|
18 | | -## Examples |
| 33 | +### Examples |
19 | 34 |
|
20 | 35 | These examples assume that the project's root directory is opened in your |
21 | 36 | favorite terminal. |
22 | 37 |
|
23 | 38 | Run 2023 Day 1: |
24 | 39 |
|
25 | | - py aoc -y 2023 -d 1 |
| 40 | + py aoc.py -y 2023 -d 1 |
26 | 41 |
|
27 | 42 | Run 2023 Day 7, and benchmark (with 100 runs by default): |
28 | 43 |
|
29 | | - py aoc -y 2023 -d 7 -b |
| 44 | + py aoc.py -y 2023 -d 7 -b |
30 | 45 |
|
31 | 46 | Run 2023 Day 13, and benchmark with 1,000 runs: |
32 | 47 |
|
33 | | - py aoc -y 2023 -d 13 -b 1000 |
34 | | - |
35 | | -Run 2023 Day 18 on `example.txt`: |
36 | | - |
37 | | - py aoc -y 2023 -d 18 -i example.txt |
38 | | - |
39 | | -## init_year.py |
40 | | - |
41 | | -`init_year.py` is for automatically initializing the files for a new year. To |
42 | | -use it, simply run it and give it a year value. (This file is intended for my |
43 | | -personal use, but I thought I'd add it to this repo anyway.) |
| 48 | + py aoc.py -y 2023 -d 13 -b 1000 |
| 49 | + |
| 50 | +Run 2023 Day 18 on the test input: |
| 51 | + |
| 52 | + py aoc.py -y 2023 -d 18 -t |
| 53 | + |
| 54 | +### start.py |
| 55 | + |
| 56 | +`start.py` is for automatically initializing the files for a new day. It takes |
| 57 | +the following options: |
| 58 | + |
| 59 | +| Short Option | Long Option | Parameter(s) | Explanation | |
| 60 | +| ------------ | ----------- | ------------------------------------ | ----------------------------------------------- | |
| 61 | +| `-h` | `--help` | none | Show a help message and exit. | |
| 62 | +| `-y` | `--year` | `n`, an integer | The year for which to create the solution file. | |
| 63 | +| `-d` | `--day` | `n`, an integer between `1` and `25` | The day for which to create the solution file. | |
| 64 | + |
| 65 | +## Solution Blog |
| 66 | + |
| 67 | +I have a blog with full step-by-step explanations of my Advent of Code solutions |
| 68 | +at <https://aoc.winslowjosiah.com>. I hope to make it a good resource for anyone |
| 69 | +who's stuck on an Advent of Code puzzle, or for anyone who's curious about my |
| 70 | +thought process and solutions specifically. |
| 71 | + |
| 72 | +The files for that blog live in the `blog` folder of this repository, and it |
| 73 | +updates automatically when I push to it thanks to the magic of [GitHub Pages](https://docs.github.com/en/pages). |
| 74 | +I use the [Astro](https://astro.build) framework (mainly because they support |
| 75 | +sweet-looking code blocks using [Expressive Code](https://expressive-code.com)), |
| 76 | +and it's styled using the [holiday.css](https://holidaycss.js.org) stylesheet. |
| 77 | + |
| 78 | +If you have any feedback about the blog, opening [a GitHub issue](https://github.com/WinslowJosiah/adventofcode/issues) |
| 79 | +on this repo is a good place to do that; otherwise, you can contact me through |
| 80 | +[Mastodon](https://hachyderm.io/@winslowjosiah), [Twitter](https://twitter.com/WinslowJosiah), |
| 81 | +or [my email ](mailto:[email protected]). |
| 82 | + |
| 83 | +## TODO |
| 84 | + |
| 85 | +- [ ] Complete past AoCs |
| 86 | + - [ ] 2015 |
| 87 | + - [ ] 2016 |
| 88 | + - [ ] 2017 |
| 89 | + - [ ] 2018 |
| 90 | + - [ ] 2019 |
| 91 | + - [ ] 2020 |
| 92 | + - [ ] 2021 |
| 93 | + - [ ] 2022 |
| 94 | + - [x] 2023 |
| 95 | + - [ ] 2024 _(have solved; have not explained on new blog)_ |
| 96 | + - [ ] 2025 |
| 97 | +- [ ] Automatically retrieve my puzzle input |
| 98 | +- [ ] Automatically submit my answers to the Advent of Code website |
0 commit comments