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
//! # Day 24: Planet of Discord
//!
//! You land on [Eris], your last stop before reaching Santa. As soon as you do, your sensors start
//! picking up strange life forms moving around: Eris is infested with [bugs]! With an over 24-hour
//! roundtrip for messages between you and Earth, you'll have to deal with this problem on your own.
//!
//! Eris isn't a very large place; a scan of the entire area fits into a 5x5 grid (your puzzle
//! input). The scan shows **bugs** (`#`) and **empty spaces** (`.`).
//!
//! Each **minute**, The bugs live and die based on the number of bugs in the **four adjacent
//! tiles**:
//!
//! - A bug **dies** (becoming an empty space) unless there is **exactly one** bug adjacent to it.
//! - An empty space **becomes infested** with a bug if **exactly one or two** bugs are adjacent to
//! it.
//!
//! Otherwise, a bug or empty space remains the same. (Tiles on the edges of the grid have fewer
//! than four adjacent tiles; the missing tiles count as empty space.) This process happens in every
//! location **simultaneously**; that is, within the same minute, the number of adjacent bugs is
//! counted for every tile first, and then the tiles are updated.
//!
//! Here are the first few minutes of an example scenario:
//!
//! ```txt
//! Initial state:
//! ....#
//! #..#.
//! #..##
//! ..#..
//! #....
//!
//! After 1 minute:
//! #..#.
//! ####.
//! ###.#
//! ##.##
//! .##..
//!
//! After 2 minutes:
//! #####
//! ....#
//! ....#
//! ...#.
//! #.###
//!
//! After 3 minutes:
//! #....
//! ####.
//! ...##
//! #.##.
//! .##.#
//!
//! After 4 minutes:
//! ####.
//! ....#
//! ##..#
//! .....
//! ##...
//! ```
//!
//! To understand the nature of the bugs, watch for the first time a layout of bugs and empty spaces
//! **matches any previous layout**. In the example above, the first layout to appear twice is:
//!
//! ```txt
//! .....
//! .....
//! .....
//! #....
//! .#...
//! ```
//!
//! To calculate the **biodiversity rating** for this layout, consider each tile left-to-right in
//! the top row, then left-to-right in the second row, and so on. Each of these tiles is worth
//! biodiversity points equal to **increasing powers of two**: 1, 2, 4, 8, 16, 32, and so on. Add up
//! the biodiversity points for tiles with bugs; in this example, the 16th tile (`32768` points) and
//! 22nd tile (`2097152` points) have bugs, a total biodiversity rating of **`2129920`**.
//!
//! **What is the biodiversity rating for the first layout that appears twice?**
//!
//! [Eris]: https://en.wikipedia.org/wiki/Eris_(dwarf_planet)
//! [bugs]: https://www.nationalgeographic.org/thisday/sep9/worlds-first-computer-bug/
use anyhow::Result;
pub const INPUT: &str = include_str!("d24.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() {}
}