Add README
This commit is contained in:
parent
3db016d630
commit
78270ccc30
|
@ -0,0 +1,60 @@
|
|||
# Advent Of Code
|
||||
|
||||
Year | Lang | Stars
|
||||
-----|------|-------
|
||||
2023 | Rust | 24
|
||||
|
||||
## Rust
|
||||
|
||||
1. Create folder `src/year_2023/day_XX_name`
|
||||
|
||||
2. Create `mod.rs`, `part_one.rs`, Optionally `common.rs`, `part_two.rs`
|
||||
|
||||
3. Edit `mod.rs`
|
||||
|
||||
```rust
|
||||
pub mod part_one;
|
||||
pub mod part_two;
|
||||
pub mod common;
|
||||
|
||||
use crate::utils::solution::Solution;
|
||||
use crate::utils::input_reader;
|
||||
|
||||
pub struct DaySolution ;
|
||||
|
||||
|
||||
impl Solution for DaySolution {
|
||||
|
||||
fn input_path(&self) -> &'static str {
|
||||
"input/XXXX/day_XX/input.txt"
|
||||
}
|
||||
|
||||
fn part_one(&self) -> String {
|
||||
input_reader::read_input_file(self.input_path(), part_one::part_one)
|
||||
}
|
||||
|
||||
fn part_two(&self) -> String {
|
||||
input_reader::read_input_file(self.input_path(), part_two::part_two)
|
||||
// String::from("Not implemented")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
4. Edit `mod.rs` in `year_XXXX` folder
|
||||
|
||||
```rust
|
||||
pub mod day_XX_problem_name;
|
||||
//...
|
||||
let solution: Box<dyn Solution> = match day {
|
||||
// ...
|
||||
"XX" => Box::new(day_XX_problem_day::DaySolution),
|
||||
// ...
|
||||
```
|
||||
|
||||
5. Copy input into `input/XXXX/day_XX/input.txt`
|
||||
|
||||
6. Run
|
||||
|
||||
```sh
|
||||
cargo run <year> <day>
|
||||
```
|
Loading…
Reference in New Issue