start 2016 day03 and start Combinations Iterator implementation

This commit is contained in:
fuckwit 2023-11-16 19:03:27 +01:00
parent 9b89f18a5f
commit a0002fdd4e
5 changed files with 1655 additions and 2 deletions

1599
input/year2016/day03.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,12 @@
pub mod util {
pub mod grid;
pub mod index;
pub mod iter;
pub mod parse;
}
pub mod year2016 {
pub mod day01;
pub mod day02;
pub mod day03;
}

View File

@ -1,4 +1,4 @@
use std::time::{Instant, Duration};
use std::time::{Duration, Instant};
use aoc::util::parse::ParseExt;
@ -69,5 +69,9 @@ fn solutions() -> impl Iterator<Item = Solution> {
}
fn year2016() -> Vec<Solution> {
vec![solution!(year2016, day01), solution!(year2016, day02)]
vec![
solution!(year2016, day01),
solution!(year2016, day02),
solution!(year2016, day03),
]
}

27
src/util/iter.rs Normal file
View File

@ -0,0 +1,27 @@
pub struct Combinations<I: Iterator> {
indices: Vec<usize>,
size: usize,
pool: Vec<I::Item>,
first: bool,
}
impl<I: Iterator> Combinations<I> {
pub fn new(iter: I, comb: usize) -> Self {
let pool: Vec<I::Item> = iter.collect();
Self {
indices: Vec::with_capacity(comb),
size: pool.len(),
pool,
first: true,
}
}
}
impl<I: Iterator> Iterator for Combinations<I> {
type Item = I::Item;
fn next(&mut self) -> Option<Self::Item> {
todo!()
}
}

21
src/year2016/day03.rs Normal file
View File

@ -0,0 +1,21 @@
use crate::util::parse::ParseExt;
pub fn part1(input: &str) -> impl std::fmt::Display {
let vec: Vec<Vec<u32>> = input.lines().map(|s| s.u32s().collect()).combin;
""
}
pub fn part2(input: &str) -> impl std::fmt::Display {
""
}
#[test]
fn test_part1() {
assert_eq!("0", part1("5 10 25").to_string())
}
#[test]
fn test_part2() {
assert_eq!("", part2("").to_string())
}