Skip to content

Commit cc836de

Browse files
committed
I super hope this works
1 parent 3e7da8b commit cc836de

File tree

255 files changed

+20912
-6532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+20912
-6532
lines changed

.github/workflows/deploy.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
# Trigger the workflow every time you push to the `main` branch
5+
# Using a different branch name? Replace `main` with your branch’s name
6+
push:
7+
branches: [ main ]
8+
# Allows you to run this workflow manually from the Actions tab on GitHub.
9+
workflow_dispatch:
10+
11+
# Allow this job to clone the repo and create a page deployment
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout your repository using git
22+
uses: actions/checkout@v5
23+
- name: Install, build, and upload your site
24+
uses: withastro/action@v5
25+
with:
26+
path: blog # The root location of your Astro project inside the repository. (optional)
27+
# node-version: 24 # The specific version of Node that should be used to build your site. Defaults to 22. (optional)
28+
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
29+
# build-cmd: pnpm run build # The command to run to build your site. Runs the package build script/task by default. (optional)
30+
# env:
31+
# PUBLIC_POKEAPI: 'https://pokeapi.co/api/v2' # Use single quotation marks for the variable value. (optional)
32+
33+
deploy:
34+
needs: build
35+
runs-on: ubuntu-latest
36+
environment:
37+
name: github-pages
38+
url: ${{ steps.deployment.outputs.page_url }}
39+
steps:
40+
- name: Deploy to GitHub Pages
41+
id: deployment
42+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22

33
# .vscode folder
44
.vscode
5-
# Markdownlint config
6-
.markdownlint-cli2.jsonc
7-
# Folder of alternate solutions
8-
alts/
95
# Puzzle input
10-
**/day*/input.txt
11-
# Puzzle descriptions
12-
**/day*/README.md
6+
solutions/*/day*/input.txt
137
# The Drakaina, before being one-line-ified
148
drakaina_formatted.py
159

README.md

Lines changed: 78 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,98 @@
11
# adventofcode
22

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!
416

517
## Usage
618

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
820
options:
921

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`. |
1732

18-
## Examples
33+
### Examples
1934

2035
These examples assume that the project's root directory is opened in your
2136
favorite terminal.
2237

2338
Run 2023 Day 1:
2439

25-
py aoc -y 2023 -d 1
40+
py aoc.py -y 2023 -d 1
2641

2742
Run 2023 Day 7, and benchmark (with 100 runs by default):
2843

29-
py aoc -y 2023 -d 7 -b
44+
py aoc.py -y 2023 -d 7 -b
3045

3146
Run 2023 Day 13, and benchmark with 1,000 runs:
3247

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

__init__.py.jinja

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)