Day 22, part 1
This commit is contained in:
18
src/bin/d22p1.rs
Normal file
18
src/bin/d22p1.rs
Normal file
@ -0,0 +1,18 @@
|
||||
use aoc22::{day22, util};
|
||||
|
||||
pub fn main() {
|
||||
let (grid, instructions) = day22::parse_map_and_path(&util::parse_input());
|
||||
|
||||
// dbg!(&grid);
|
||||
// dbg!(&instructions);
|
||||
|
||||
let mut pose = day22::Pose::new(&grid);
|
||||
// dbg!(&pose);
|
||||
for inst in &instructions {
|
||||
pose = day22::exec_instruction(&grid, &pose, inst);
|
||||
// dbg!(&pose);
|
||||
}
|
||||
|
||||
let pass = 1000 * (pose.pos.0 + 1) + 4 * (pose.pos.1 + 1) + (pose.orientation as usize);
|
||||
println!("Passowrd: {}", pass);
|
||||
}
|
||||
Reference in New Issue
Block a user