From 23bc51e78cf7b83af2eca91a7e0fb927204bdb88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20LUDWIG?= Date: Thu, 8 Feb 2024 21:04:22 +0100 Subject: [PATCH] docs: add day 8 - part 2 instructions --- README.md | 13 ++++++++++++- day_8/README.md | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e84191..1147582 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,17 @@ Conventional Commits

+## Days Progress + +- [Day 1 (`**`)](./day_1) +- [Day 2 (`**`)](./day_2) +- [Day 3 (`**`)](./day_3) +- [Day 4 (`**`)](./day_4) +- [Day 5 (`**`)](./day_5) +- [Day 6 (`**`)](./day_6) +- [Day 7 (`*`)](./day_7) +- [Day 8 (`*`)](./day_8) + ## Getting Started ### Prerequisites @@ -29,7 +40,7 @@ The project is **tested** against the following Rust versions: #### External Linting Tools (optional) -**External linting tools** are used to ensure a consistent code style and commit message format. They are **used in the Continuous Integration (CI)** pipeline and **can be optionally used locally**. +**External linting tools** are used to ensure a consistent code style (external to Rust) and commit message format. They are **used in the Continuous Integration (CI)** pipeline and **can be optionally used locally**. They have to be installed using [Node.js](https://nodejs.org/) >= v20.0.0 and [npm](https://www.npmjs.com/) >= v10.0.0. diff --git a/day_8/README.md b/day_8/README.md index 84bd1ad..bc136b0 100644 --- a/day_8/README.md +++ b/day_8/README.md @@ -39,3 +39,40 @@ ZZZ = (ZZZ, ZZZ) ``` Starting at `AAA`, follow the left/right instructions. **How many steps are required to reach `ZZZ`?** + +## Instructions - Part 2 + +The sandstorm is upon you and you aren't any closer to escaping the wasteland. You had the camel follow the instructions, but you've barely left your starting position. It's going to take **significantly more steps** to escape! + +What if the map isn't for people - what if the map is for **ghosts**? Are ghosts even bound by the laws of spacetime? Only one way to find out. + +After examining the maps a bit longer, your attention is drawn to a curious fact: the number of nodes with names ending in `A` is equal to the number ending in `Z`! If you were a ghost, you'd probably just **start at every node that ends with `A`** and follow all of the paths at the same time until they all simultaneously end up at nodes that end with `Z`. + +For example: + +```txt +LR + +11A = (11B, XXX) +11B = (XXX, 11Z) +11Z = (11B, XXX) +22A = (22B, XXX) +22B = (22C, 22C) +22C = (22Z, 22Z) +22Z = (22B, 22B) +XXX = (XXX, XXX) +``` + +Here, there are two starting nodes, `11A` and `22A` (because they both end with `A`). As you follow each left/right instruction, use that instruction to **simultaneously** navigate away from both nodes you're currently on. Repeat this process until **all** of the nodes you're currently on end with `Z`. (If only some of the nodes you're on end with `Z`, they act like any other node and you continue as normal.) In this example, you would proceed as follows: + +- Step 0: You are at `11A` and `22A`. +- Step 1: You choose all of the **left** paths, leading you to `11B` and `22B`. +- Step 2: You choose all of the **right** paths, leading you to **`11Z`** and `22C`. +- Step 3: You choose all of the **left** paths, leading you to `11B` and **`22Z`**. +- Step 4: You choose all of the **right** paths, leading you to **`11Z`** and `22B`. +- Step 5: You choose all of the **left** paths, leading you to `11B` and `22C`. +- Step 6: You choose all of the **right** paths, leading you to **`11Z`** and **`22Z`**. + +So, in this example, you end up entirely on nodes that end in `Z` after **`6`** steps. + +Simultaneously start on every node that ends with `A`. **How many steps does it take before you're only on nodes that end with `Z`?**