start day 5

This commit is contained in:
Joseph Montanaro 2022-12-05 16:46:00 -08:00
parent 19d28ea991
commit a10ff091da

29
2022/src/day5.rs Normal file
View File

@ -0,0 +1,29 @@
const DATA: &'static str = "
[D]
[N] [C]
[Z] [M] [P]
1 2 3
move 1 from 2 to 1
move 3 from 1 to 3
move 2 from 2 to 1
move 1 from 1 to 2
";
struct State {
stacks: Vec<Vec<char>>,
}
impl std::str::FromStr for State {
fn from_str(data: &str) -> State {
let lines: Vec<&str> = data.lines().collect();
let mut stacks = Vec::new(Vec::new());
// skip the first row, because it's just the stack numbers
for row in lines.rev().skip(1) {
for (i, ident) in row.split(' ') {
let ident = ident.trim_matches(|c| c == '[' || c == ']');
}
}
}
}