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

25
old/day12/Cargo.lock generated Normal file
View File

@@ -0,0 +1,25 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "day12"
version = "0.1.0"
dependencies = [
"itertools",
]
[[package]]
name = "either"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "itertools"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
dependencies = [
"either",
]

9
old/day12/Cargo.toml Normal file
View File

@@ -0,0 +1,9 @@
[package]
name = "day12"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
itertools = "0.12.0"

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")
}
}
}