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
Copy file name to clipboardExpand all lines: README.md
+37-27Lines changed: 37 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -7,25 +7,25 @@
7
7
8
8
<!--- advent_readme_stars table --->
9
9
10
-
---
10
+
## Setup
11
+
12
+
### Create your _advent of code_ repository
11
13
12
-
Generated from [fspoettel/advent-of-code-rust](https://github.com/fspoettel/advent-of-code-rust).
14
+
1. Open [the template repository](https://github.com/fspoettel/advent-of-code-rust) on Github.
15
+
2. Click `Use this template` and create your repository.
16
+
3. Clone your repository to your computer.
13
17
14
-
##Create your own
18
+
### Setup rust
15
19
16
-
1.Open ☝️ template on Github.
17
-
2.Click `Use this template` and create your repository.
18
-
3.Clone the repository to your machine.
20
+
1. Install the [Rust toolchain](https://www.rust-lang.org/tools/install).
21
+
2. (recommended) Install the [rust-analyzer](https://rust-analyzer.github.io/manual.html) extension for your code editor.
22
+
3. (optional) Install a native debugger. If you are using VS Code, [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) is a good option.
19
23
20
-
## Install
24
+
---
21
25
22
-
* Install the [Rust toolchain](https://www.rust-lang.org/tools/install).
23
-
* (optional) Install [rust-analyzer](https://rust-analyzer.github.io/manual.html) for your editor.
24
-
* (optional) Install a native debugger, e.g. [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) for VS Code.
25
-
* (optional) Install [`aoc-cli`](https://github.com/scarvalhojr/aoc-cli/) and follow their setup guide to use the `download` script for puzzle inputs. (see below)
26
-
* (optional) Setup the README stars github action. (see below)
26
+
✨ You can start solving puzzles now! Head to the [Usage section](#usage) to see how to use this template. If you like, you can configure [some optional features](#optional-template-features).
27
27
28
-
## Commands
28
+
## Usage
29
29
30
30
### Setup new day
31
31
@@ -41,12 +41,15 @@ Generated from [fspoettel/advent-of-code-rust](https://github.com/fspoettel/adve
41
41
# 🎄 Type `cargo run --bin 01` to run your solution.
42
42
```
43
43
44
-
Individual solutions live in the `./src/bin` directory as separate binaries.
44
+
Individual solutions live in the `./src/bin/` directory as separate binaries.
45
45
46
-
Every [solution](https://github.com/fspoettel/advent-of-code-rust/blob/master/bin/scaffold#L21-L52) has _unit tests_ referencing the_example_ file. Use these tests to develop and debug your solution. When editing a solution, `rust-analyzer` will display buttons for these actions above the unit tests.
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.
47
47
48
48
### Download inputs for a day
49
49
50
+
> **Note**
51
+
> This command requires configuring the optional [automatic input downloads](#automatic-input-downloads) feature.
52
+
50
53
```sh
51
54
# example: `./bin/download 1`
52
55
./bin/download <day>
@@ -108,7 +111,7 @@ cargo run
108
111
109
112
To run an optimized version for benchmarking, use the `--release` flag or the alias `cargo rr`.
110
113
111
-
_Total timing_ is computed from individual solution _timings_ and excludes overhead.
114
+
_Total timing_ is computed from individual solution _timings_ and excludes as much overhead as possible.
112
115
113
116
### Run all solutions against example input
114
117
@@ -128,23 +131,30 @@ cargo fmt
128
131
cargo clippy
129
132
```
130
133
131
-
## Setup readme stars
134
+
## Optional template features
135
+
136
+
### Automatic input downloads
137
+
138
+
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).
139
+
140
+
### Readme progress tracker
132
141
133
142
This template includes [a Github action](https://github.com/k2bd/advent-readme-stars) that automatically updates the readme with your advent of code progress.
134
143
135
-
To enable it, you need to do two things:
144
+
To enable it, complete the following steps:
136
145
137
-
1. set repository secrets.
138
-
2. create a private leaderboard.
146
+
#### 1. Create private leaderboard
139
147
140
-
### Repository secrets
148
+
Go to the leaderboard page of the year you want to track and click _Private Leaderboard_. If you have not created a leaderboard yet, create one by clicking _Create It_. Your leaderboard should be accessible under `https://adventofcode.com/{year}/leaderboard/private/view/{aoc_user_id}`.
141
149
142
-
Go to the _Secrets_ tab in your repository settings and create the following secrets:
150
+
#### 2. Set repository secrets
143
151
144
-
*`AOC_USER_ID`: Go to [this page](https://adventofcode.com/settings) and copy your user id. It's the number behind the `#` symbol in the first name option. Example: `3031`
145
-
*`AOC_YEAR`: the year you want to track. Example: `2021`
146
-
*`AOC_SESSION`: an active session for the advent of code website. 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.
152
+
Go to the _Secrets_ tab in your repository settings and create the following secrets:
147
153
148
-
### Private Leaderboard
154
+
-`AOC_ENABLED`: This variable controls whether the workflow is enabled. Set it to `true` to enable the progress tracker.
155
+
-`AOC_USER_ID`: Go to [this page](https://adventofcode.com/settings) and copy your user id. It's the number behind the `#` symbol in the first name option. Example: `3031`
156
+
-`AOC_YEAR`: the year you want to track. Example: `2021`
157
+
-`AOC_SESSION`: an active session for the advent of code website. 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.
149
158
150
-
Go to the leaderboard page of the year you want to track and click _Private Leaderboard_. If you have not created a leaderboard yet, create one by clicking _Create It_. Your leaderboard should be accessible under `https://adventofcode.com/{year}/leaderboard/private/view/{aoc_user_id}`.
159
+
> **Note**
160
+
> 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.
0 commit comments