summaryrefslogtreecommitdiff
path: root/2023/src/bin/day_19.rs
diff options
context:
space:
mode:
Diffstat (limited to '2023/src/bin/day_19.rs')
-rw-r--r--2023/src/bin/day_19.rs58
1 files changed, 52 insertions, 6 deletions
diff --git a/2023/src/bin/day_19.rs b/2023/src/bin/day_19.rs
index b3a610b..fd25a5d 100644
--- a/2023/src/bin/day_19.rs
+++ b/2023/src/bin/day_19.rs
@@ -1,19 +1,65 @@
use nom::IResult;
-use std::fs;
+use std::{collections::BTreeMap, fs};
fn main() -> Result<(), Box<dyn std::error::Error>> {
- let input = fs::read_to_string("inputs/day_2.txt")?;
- let parsed = Example::parser(&input).unwrap().1;
+ let input = fs::read_to_string("inputs/day_19.txt")?;
+ let parsed = PartSortingMess::parser(&input).unwrap().1;
dbg!(&parsed);
Ok(())
}
#[derive(Debug)]
-struct Example;
+struct PartSortingMess {
+ workflows: BTreeMap<String, Workflow>,
+ parts: Vec<Part>,
+}
+
+#[derive(Debug)]
+struct Workflow {
+ id: String,
+ conditions: WorkflowStep,
+ if_none_match: WorkflowOutcome,
+}
+
+#[derive(Debug)]
+struct WorkflowStep {
+ field: PartField,
+ condition: WorkflowCondition,
+ result: WorkflowOutcome,
+}
+
+#[derive(Debug)]
+enum PartField {
+ X,
+ M,
+ A,
+ S,
+}
+
+#[derive(Debug)]
+enum WorkflowCondition {
+ LessThan(u32),
+ GreaterThan(u32),
+}
+
+#[derive(Debug)]
+enum WorkflowOutcome {
+ Accept,
+ Reject,
+ Defer(String),
+}
+
+#[derive(Debug)]
+struct Part {
+ x: u32,
+ m: u32,
+ a: u32,
+ s: u32,
+}
-impl Example {
- fn parser(_input: &str) -> IResult<&str, Self> {
+impl PartSortingMess {
+ fn parser(input: &str) -> IResult<&str, Self> {
todo!()
}
}