aoc22/src/bin/d22p1.rs
2022-12-22 17:21:06 +01:00

22 lines
510 B
Rust

use aoc22::{
day22::{self, Navigable},
util,
};
pub fn main() {
let (grid, instructions) = day22::parse_map_and_path(&util::parse_input());
// dbg!(&grid);
// dbg!(&instructions);
let mut pose = grid.initial_pose();
// dbg!(&pose);
for inst in &instructions {
pose = grid.exec_instruction(&pose, inst).0;
// dbg!(&pose);
}
let pass = 1000 * (pose.pos.0 + 1) + 4 * (pose.pos.1 + 1) + (pose.orientation as usize);
println!("Passowrd: {}", pass);
}