1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
//! # Day 15: Oxygen System
//!
//! Out here in deep space, many things can go wrong. Fortunately, many of those things have
//! indicator lights. Unfortunately, one of those lights is lit: the oxygen system for part of the
//! ship has failed!
//!
//! According to the readouts, the oxygen system must have failed days ago after a rupture in oxygen
//! tank two; that section of the ship was automatically sealed once oxygen levels went dangerously
//! low. A single remotely-operated **repair droid** is your only option for fixing the oxygen
//! system.
//!
//! The Elves' care package included an [Intcode] program (your puzzle input) that you can use to
//! remotely control the repair droid. By running that program, you can direct the repair droid to
//! the oxygen system and fix the problem.
//!
//! The remote control program executes the following steps in a loop forever:
//!
//! - Accept a **movement command** via an input instruction.
//! - Send the movement command to the repair droid.
//! - Wait for the repair droid to finish the movement operation.
//! - Report on the **status** of the repair droid via an output instruction.
//!
//! Only four **movement commands** are understood: north (`1`), south (`2`), west (`3`), and east
//! (`4`). Any other command is invalid. The movements differ in direction, but not in distance: in
//! a long enough east-west hallway, a series of commands like `4,4,4,4,3,3,3,3` would leave the
//! repair droid back where it started.
//!
//! The repair droid can reply with any of the following **status** codes:
//!
//! - `0`: The repair droid hit a wall. Its position has not changed.
//! - `1`: The repair droid has moved one step in the requested direction.
//! - `2`: The repair droid has moved one step in the requested direction; its new position is the
//! location of the oxygen system.
//!
//! You don't know anything about the area around the repair droid, but you can figure it out by
//! watching the status codes.
//!
//! For example, we can draw the area using `D` for the droid, `#` for walls, `.` for locations the
//! droid can traverse, and empty space for unexplored locations. Then, the initial state looks like
//! this:
//!
//! ```txt
//!
//!
//! D
//!
//!
//! ```
//!
//! To make the droid go north, send it `1`. If it replies with `0`, you know that location is a
//! wall and that the droid didn't move:
//!
//! ```txt
//!
//! #
//! D
//!
//!
//! ```
//!
//! To move east, send `4`; a reply of `1` means the movement was successful:
//!
//! ```txt
//!
//! #
//! .D
//!
//!
//! ```
//!
//! Then, perhaps attempts to move north (`1`), south (`2`), and east (`4`) are all met with replies
//! of `0`:
//!
//! ```txt
//!
//! ##
//! .D#
//! #
//!
//! ```
//!
//! Now, you know the repair droid is in a dead end. Backtrack with `3` (which you already know will
//! get a reply of `1` because you already know that location is open):
//!
//! ```txt
//!
//! ##
//! D.#
//! #
//!
//! ```
//!
//! Then, perhaps west (`3`) gets a reply of `0`, south (`2`) gets a reply of `1`, south again (`2`)
//! gets a reply of `0`, and then west (`3`) gets a reply of `2`:
//!
//! ```txt
//!
//! ##
//! #..#
//! D.#
//! #
//! ```
//!
//! Now, because of the reply of `2`, you know you've found the **oxygen system**! In this example,
//! it was only **`2`** moves away from the repair droid's starting position.
//!
//! **What is the fewest number of movement commands** required to move the repair droid from its
//! starting position to the location of the oxygen system?
//!
//! [Intcode]: super::d09
use anyhow::Result;
pub const INPUT: &str = include_str!("d15.txt");
pub fn solve_part_one(input: &str) -> Result<i64> {
Ok(0)
}
pub fn solve_part_two(input: &str) -> Result<i64> {
Ok(0)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part_one() {}
#[test]
fn part_two() {}
}