-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
077ff7a
commit 48c1a1d
Showing
4 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "day11" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
tracing = {workspace = true} | ||
tracing-test = {workspace = true} | ||
anyhow = {workspace = true} | ||
regex = {workspace = true} | ||
lazy_static = {workspace = true} | ||
|
||
[dependencies.utils] | ||
path = "../utils" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use std::io::{BufRead, BufReader}; | ||
|
||
pub type ResultType = u64; | ||
|
||
#[derive(Debug, Default)] | ||
pub struct Solution {} | ||
impl Solution {} | ||
|
||
#[allow(unused_variables, unused_mut)] | ||
impl<T: std::io::Read> TryFrom<BufReader<T>> for Solution { | ||
type Error = std::io::Error; | ||
|
||
fn try_from(reader: BufReader<T>) -> Result<Self, Self::Error> { | ||
let mut solution = Self::default(); | ||
for (id, line) in reader.lines().flatten().enumerate() { | ||
// Implement for problem | ||
} | ||
Ok(solution) | ||
} | ||
} | ||
impl utils::Solution for Solution { | ||
type Result = anyhow::Result<ResultType>; | ||
fn analyse(&mut self, _is_full: bool) {} | ||
|
||
fn answer_part1(&self, _is_full: bool) -> Self::Result { | ||
// Implement for problem | ||
Ok(0) | ||
} | ||
|
||
fn answer_part2(&self, _is_full: bool) -> Self::Result { | ||
// Implement for problem | ||
Ok(0) | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod test { | ||
use super::*; | ||
use std::io::BufReader; | ||
|
||
use utils::Solution; | ||
|
||
#[test] | ||
fn read() { | ||
let input = "replace for problem"; | ||
let r = BufReader::new(input.as_bytes()); | ||
let s = crate::Solution::try_from(r).unwrap(); | ||
assert_eq!(0 as ResultType, s.answer_part1(false).unwrap()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use anyhow::Result; | ||
use day11::{ResultType, Solution}; | ||
|
||
fn main() -> Result<()> { | ||
utils::log_init(); | ||
|
||
utils::run::<Solution, ResultType>(&["sample"], &["full"]) | ||
} |