delete accidental submodule

This commit is contained in:
2023-12-14 10:46:45 -05:00
parent 5a87bfb681
commit 51c64d827b
37 changed files with 1637 additions and 1 deletions

54
old/day12/src/main.rs Normal file
View File

@@ -0,0 +1,54 @@
use std::fs;
use itertools::Itertools;
fn main() {
let input = parse_input();
for (springs, groups) in input {
println!("{:?} {:?}", springs, groups);
}
}
fn parse_input() -> Vec<(Vec<Condition>, Vec<i32>)> {
let input = fs::read_to_string("input.txt").unwrap();
let input: Vec<(Vec<Condition>, Vec<i32>)> = input.split('\n')
.map(|line| {
line.split(' ')
.collect_tuple()
.unwrap()
}).map(|(springs, groups)| {
let springs: Vec<Condition> = springs.chars()
.map(|char| {
char.to_condition()
}).collect();
let groups: Vec<_> = groups.split(',')
.map(|num| num.parse::<i32>().expect("Failed to parse group len"))
.collect();
(springs, groups)
}).collect();
input
}
#[derive(Debug)]
enum Condition {
Good,
Bad,
WhoKnows
}
trait ConditionConvertable {
fn to_condition(self) -> Condition;
}
impl ConditionConvertable for char {
fn to_condition(self) -> Condition {
match self {
'.' => Condition::Good,
'#' => Condition::Bad,
'?' => Condition::WhoKnows,
_ => panic!("Invalid spring char AHHH")
}
}
}