You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cross-platform template for solving Advent of Code in Rust.
7
6
8
7
<!--- advent_readme_stars table --->
9
8
@@ -43,12 +42,14 @@ cargo scaffold <day>
43
42
44
43
Individual solutions live in the `./src/bin/` directory as separate binaries.
45
44
46
-
Every [solution](https://github.com/fspoettel/advent-of-code-rust/blob/master/bin/scaffold#L21-L52) has _unit tests_ referencing its _example_ file. Use these unit tests to develop and debug your solution against example inputs. When editing a solution, `rust-analyzer` will display buttons for these actions above the unit tests.
45
+
Every [solution](https://github.com/fspoettel/advent-of-code-rust/blob/master/src/bin/scaffold.rs#L7-L35) has _unit tests_ referencing its _example_ file. Use these unit tests to develop and debug your solution against example inputs. For some puzzles, it might be easier to forgo the example file and hardcode inputs into the tests.
46
+
47
+
When editing a solution, `rust-analyzer` will display buttons for these actions above the unit tests.
47
48
48
49
### Download inputs for a day
49
50
50
51
> **Note**
51
-
> This command requires configuring the optional [automatic input downloads](#automatic-input-downloads) feature.
52
+
> This command requires [installing the aoc-cli crate](#download-inputs-via-aoc-cli).
52
53
53
54
```sh
54
55
# example: `cargo download 1`
@@ -66,7 +67,7 @@ cargo download <day>
66
67
67
68
To download inputs for previous years, append the `--year` flag. _(example: `cargo download 1 --year 2020`)_
68
69
69
-
Puzzle inputs are not checked into git. [See here](https://old.reddit.com/r/adventofcode/comments/k99rod/sharing_input_data_were_we_requested_not_to/gf2ukkf/?context=3) why.
70
+
Puzzle inputs are not checked into git. [Reasoning](https://old.reddit.com/r/adventofcode/comments/k99rod/sharing_input_data_were_we_requested_not_to/gf2ukkf/?context=3).
70
71
71
72
### Run solutions for a day
72
73
@@ -87,7 +88,7 @@ cargo run --bin <day>
87
88
88
89
To run an optimized version for benchmarking, use the `--release` flag or the alias `cargo rr --bin <day>`.
89
90
90
-
Displayed _timings_ show the raw execution time of your solution w/o overhead (e.g. file reads).
91
+
Displayed _timings_ show the raw execution time of your solution without overhead (e.g. file reads).
91
92
92
93
### Run solutions for all days
93
94
@@ -134,9 +135,19 @@ cargo clippy
134
135
135
136
## Optional template features
136
137
137
-
### Automatic input downloads
138
+
### Download inputs via aoc-cli
139
+
140
+
1. Install [`aoc-cli`](https://github.com/scarvalhojr/aoc-cli/) via cargo: `cargo install aoc-cli`.
141
+
2. Create an `.adventofcode.session` file in your home directory and paste your session cookie into it. To get this, press F12 anywhere on the Advent of Code website to open your browser developer tools. Look in your Cookies under the Application or Storage tab, and copy out the `session` cookie value.
142
+
143
+
Once installed, you can use the [download command](#download-inputs-for-a-day).
144
+
145
+
> **Note**
146
+
> The session cookie might expire after a while (~1 month) which causes the downloads to fail. To fix this issue, refresh the `.adventofcode.session` file.
147
+
148
+
### CI: enable clippy lints
138
149
139
-
Install [`aoc-cli`](https://github.com/scarvalhojr/aoc-cli/) and follow their setup instructions. Once installed, you can use the [download command](#download-inputs-for-a-day).
150
+
Uncomment the `clippy` job in the `ci.yml` workflow to enable clippy checks in CI.
140
151
141
152
### Readme progress tracker
142
153
@@ -160,10 +171,6 @@ Go to the _Secrets_ tab in your repository settings and create the following sec
160
171
> **Note**
161
172
> The session cookie might expire after a while (~1 month) which causes the automated workflow to fail. To fix this issue, refresh the `AOC_SESSION` secret.
162
173
163
-
### CI: enable clippy lints
164
-
165
-
Uncomment the `clippy` job in the `ci.yml` workflow to enable clippy checks in CI.
166
-
167
174
## Useful crates
168
175
169
176
-[itertools](https://crates.io/crates/itertools): Extends iterators with extra methods and adaptors. Frequently useful for aoc puzzles.
0 commit comments