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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
//! # Day 22: Sporifica Virus
//!
//! Diagnostics indicate that the local **grid computing cluster** has been contaminated with the
//! **Sporifica Virus**. The grid computing cluster is a seemingly-infinite two-dimensional grid of
//! compute nodes. Each node is either **clean** or **infected** by the virus.
//!
//! To [prevent overloading] the nodes (which would render them useless to the virus) or detection
//! by system administrators, exactly one **virus carrier** moves through the network, infecting or
//! cleaning nodes as it moves. The virus carrier is always located on a single node in the network
//! (the **current node**) and keeps track of the **direction** it is facing.
//!
//! To avoid detection, the virus carrier works in bursts; in each burst, it **wakes up**, does some
//! **work**, and goes back to **sleep**. The following steps are all executed **in order** one time
//! each burst:
//!
//! - If the **current node** is **infected**, it turns to its **right**. Otherwise, it turns to its
//! **left**. (Turning is done in-place; the **current node** does not change.)
//! - If the **current node** is **clean**, it becomes **infected**. Otherwise, it becomes
//! **cleaned**. (This is done **after** the node is considered for the purposes of changing
//! direction.)
//! - The virus carrier [moves] **forward** one node in the direction it is facing.
//!
//! Diagnostics have also provided a **map of the node infection status** (your puzzle input).
//! **Clean** nodes are shown as `.`; **infected** nodes are shown as `#`. This map only shows the
//! center of the grid; there are many more nodes beyond those shown, but none of them are currently
//! infected.
//!
//! The virus carrier begins in the middle of the map facing **up**.
//!
//! For example, suppose you are given a map like this:
//!
//! ```txt
//! ..#
//! #..
//! ...
//! ```
//!
//! Then, the middle of the infinite grid looks like this, with the virus carrier's position marked
//! with `[ ]`:
//!
//! ```txt
//! . . . . . . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! . . . . . # . . .
//! . . . #[.]. . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! ```
//!
//! The virus carrier is on a **clean** node, so it turns **left**, **infects** the node, and moves
//! left:
//!
//! ```txt
//! . . . . . . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! . . . . . # . . .
//! . . .[#]# . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! ```
//!
//! The virus carrier is on an **infected** node, so it turns **right**, **cleans** the node, and
//! moves up:
//!
//! ```txt
//! . . . . . . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! . . .[.]. # . . .
//! . . . . # . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! ```
//!
//! Four times in a row, the virus carrier finds a **clean**, **infects** it, turns **left**, and
//! moves forward, ending in the same place and still facing up:
//!
//! ```txt
//! . . . . . . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! . . #[#]. # . . .
//! . . # # # . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! ```
//!
//! Now on the same node as before, it sees an infection, which causes it to turn **right**,
//! **clean** the node, and move forward:
//!
//! ```txt
//! . . . . . . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! . . # .[.]# . . .
//! . . # # # . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! . . . . . . . . .
//! ```
//!
//! After the above actions, a total of `7` bursts of activity had taken place. Of them, `5` bursts
//! of activity caused an infection.
//!
//! After a total of `70`, the grid looks like this, with the virus carrier facing up:
//!
//! ```txt
//! . . . . . # # . .
//! . . . . # . . # .
//! . . . # . . . . #
//! . . # . #[.]. . #
//! . . # . # . . # .
//! . . . . . # # . .
//! . . . . . . . . .
//! . . . . . . . . .
//! ```
//!
//! By this time, `41` bursts of activity caused an infection (though most of those nodes have since
//! been cleaned).
//!
//! After a total of `10000` bursts of activity, `5587` bursts will have caused an infection.
//!
//! Given your actual map, after `10000` bursts of activity, **how many bursts cause a node to
//! become infected**? (Do not count nodes that begin infected.)
//!
//! [prevent overloading]: https://en.wikipedia.org/wiki/Morris_worm#The_mistake
//! [moves]: https://www.youtube.com/watch?v=2vj37yeQQHg
use anyhow::Result;
pub const INPUT: &str = include_str!("d22.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() {}
}