Skip to content

Commit

Permalink
Day 11 init
Browse files Browse the repository at this point in the history
  • Loading branch information
SMartinScottLogic committed Dec 10, 2023
1 parent 077ff7a commit 48c1a1d
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = [
"template",
"xtask",
"day1"
, "day2", "day3", "day4", "day5", "day6", "day7", "day8", "day9", "day10"]
, "day2", "day3", "day4", "day5", "day6", "day7", "day8", "day9", "day10", "day11"]

[workspace.dependencies]
# Flexible concrete Error type built on std::error::Error
Expand Down
14 changes: 14 additions & 0 deletions day11/Cargo.toml
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"
50 changes: 50 additions & 0 deletions day11/src/lib.rs
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());
}
}
8 changes: 8 additions & 0 deletions day11/src/main.rs
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"])
}

0 comments on commit 48c1a1d

Please sign in to comment.