Skip to content

Updated readme with more instructions #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
# Advent of Code Template

A rust template for Advent of Code.
A [rust](https://www.rust-lang.org/) template for [Advent of Code](https://adventofcode.com).

## Usage
## Initial Setup

run
```
AOC_YEAR=2020 AOC_SESSION=<Your session key> AOC_INPUT=<Your input directory> cargo build
```
to set up the project.
1. Clone this repo.
2. Setup your environment:
* `export AOC_YEAR=<year>`
* `export AOC_SESSION=<Your session key>`
* `export AOC_INPUT=<Your input directory>`
3. Run _**ONCE**_: `cargo build`
4. Delete `build.rs` - you don't need to build again.

`session` and `input dir` can be set later in `.env`.
## Daily Challenges

1. Download the day's file: `cargo run -- init <day>`. The file will be downloaded into the `AOC_INPUT` directory.
2. Write your code in the "day" files in `src/solutions/dayX.rs`
3. Build and run your code: `cargo run -- run <day> [--part <part>] [--extra arg1 arg2 arg3] [--input path/to/input]`
* The arguments within [ ] are optional.
* Skipping `--part` will run both part 1 and part 2.
* Skipping `--extra` will give an empty `Vec<T>` of extra args.
* Skipping `--input` will look for the download input in `AOC_INPUT`.

## Notes

Expand All @@ -19,10 +29,6 @@ to set up the project.
3. `build.rs` is very brittle and made only for the initial state of the repo.
4. The author in `Cargo.toml` is me. Change it if you want.

## Warning
### Do not run `build.rs` after you have started writing your code.

## Future Thoughts
## Warning!
_**Do not run `build.rs` after you have started writing your code.**_

1. Make solutions part of a workspace so they can have independent dependencies.
2. Make `build.rs` more flexible.