Hide ugly stuff a little better
This commit is contained in:
parent
8f3a7b56f0
commit
0ec95b96d3
|
@ -145,7 +145,15 @@ fn explore(bot: Robot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
fn get_bot_at_generator() -> Robot {
|
fn find_generator() -> Robot {
|
||||||
|
save((0, 0).into(), Tile::Empty);
|
||||||
|
let bot = Robot {
|
||||||
|
pos: (0, 0).into(),
|
||||||
|
dir: Direction::Up,
|
||||||
|
ic: IntComputer::new(read_input(), 0, vec![]),
|
||||||
|
steps: 0,
|
||||||
|
};
|
||||||
|
explore(bot);
|
||||||
OXYGEN_BOT.lock().unwrap().pop().expect("No oxygen found in Part 1")
|
OXYGEN_BOT.lock().unwrap().pop().expect("No oxygen found in Part 1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,15 +161,7 @@ fn get_bot_at_generator() -> Robot {
|
||||||
const ENABLE_MAP_PRINT: bool = true;
|
const ENABLE_MAP_PRINT: bool = true;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut bot = Robot {
|
let mut bot = find_generator();
|
||||||
pos: (0, 0).into(),
|
|
||||||
dir: Direction::Up,
|
|
||||||
ic: IntComputer::new(read_input(), 0, vec![]),
|
|
||||||
steps: 0,
|
|
||||||
};
|
|
||||||
save(bot.pos, Tile::Empty);
|
|
||||||
explore(bot);
|
|
||||||
bot = get_bot_at_generator();
|
|
||||||
println!("Part 1: {}", bot.steps);
|
println!("Part 1: {}", bot.steps);
|
||||||
bot.steps = 0;
|
bot.steps = 0;
|
||||||
println!("Part 2: {}", fill(bot));
|
println!("Part 2: {}", fill(bot));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user