diff options
author | kaiwu <kaiwu2004@gmail.com> | 2023-02-09 17:01:36 +0800 |
---|---|---|
committer | kaiwu <kaiwu2004@gmail.com> | 2023-02-09 17:01:36 +0800 |
commit | d496215180f2e8999997c421507fb643fbff876e (patch) | |
tree | 0dc36fed97b5dbbd9f3d903403a4cd284bb07d96 /src/2017/day16/README.md | |
parent | 6e66e948fd41ad01ec853ee297add1e7fe554298 (diff) | |
download | advent-of-code-d496215180f2e8999997c421507fb643fbff876e.tar.gz advent-of-code-d496215180f2e8999997c421507fb643fbff876e.zip |
2017 day16
Diffstat (limited to 'src/2017/day16/README.md')
-rw-r--r-- | src/2017/day16/README.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/2017/day16/README.md b/src/2017/day16/README.md index e69de29..2d427c9 100644 --- a/src/2017/day16/README.md +++ b/src/2017/day16/README.md @@ -0,0 +1,30 @@ +--- Day 16: Permutation Promenade --- +You come upon a very unusual sight; a group of programs here appear to be dancing. + +There are sixteen programs in total, named a through p. They start by standing in a line: a stands in position 0, b stands in position 1, and so on until p, which stands in position 15. + +The programs' dance consists of a sequence of dance moves: + +Spin, written sX, makes X programs move from the end to the front, but maintain their order otherwise. (For example, s3 on abcde produces cdeab). +Exchange, written xA/B, makes the programs at positions A and B swap places. +Partner, written pA/B, makes the programs named A and B swap places. +For example, with only five programs standing in a line (abcde), they could do the following dance: + +s1, a spin of size 1: eabcd. +x3/4, swapping the last two programs: eabdc. +pe/b, swapping programs e and b: baedc. +After finishing their dance, the programs end up in order baedc. + +You watch the dance for a while and record their dance moves (your puzzle input). In what order are the programs standing after their dance? + +--- Part Two --- +Now that you're starting to get a feel for the dance moves, you turn your attention to the dance as a whole. + +Keeping the positions they ended up in from their previous dance, the programs perform it again and again: including the first dance, a total of one billion (1000000000) times. + +In the example above, their second dance would begin with the order baedc, and use the same dance moves: + +s1, a spin of size 1: cbaed. +x3/4, swapping the last two programs: cbade. +pe/b, swapping programs e and b: ceadb. +In what order are the programs standing after their billion dances? |