Day 9, both puzzles
This commit is contained in:
14
src/bin/d9p1.rs
Normal file
14
src/bin/d9p1.rs
Normal file
@ -0,0 +1,14 @@
|
||||
use aoc22::{day9, util};
|
||||
|
||||
pub fn main() {
|
||||
let motions = day9::parse_motions(&util::parse_input());
|
||||
let mut state = day9::State::new(1);
|
||||
|
||||
for motion in &motions {
|
||||
day9::execute_motion(&mut state, &motion);
|
||||
}
|
||||
|
||||
println!("State after all motions:");
|
||||
state.print();
|
||||
println!("Visited fields: {}", state.visited.len());
|
||||
}
|
||||
14
src/bin/d9p2.rs
Normal file
14
src/bin/d9p2.rs
Normal file
@ -0,0 +1,14 @@
|
||||
use aoc22::{day9, util};
|
||||
|
||||
pub fn main() {
|
||||
let motions = day9::parse_motions(&util::parse_input());
|
||||
let mut state = day9::State::new(9);
|
||||
|
||||
for motion in &motions {
|
||||
day9::execute_motion(&mut state, &motion);
|
||||
}
|
||||
|
||||
println!("State after all motions:");
|
||||
state.print();
|
||||
println!("Visited fields: {}", state.visited.len());
|
||||
}
|
||||
Reference in New Issue
Block a user