Add 2024 Quests 17 - 19
This commit is contained in:
parent
5d1320bec9
commit
6632529d20
27 changed files with 1613 additions and 0 deletions
6
2024/day19_encrypted_duck/Cargo.toml
Normal file
6
2024/day19_encrypted_duck/Cargo.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "day19_encrypted_duck"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
134
2024/day19_encrypted_duck/challenge.txt
Normal file
134
2024/day19_encrypted_duck/challenge.txt
Normal file
|
@ -0,0 +1,134 @@
|
|||
Part I
|
||||
|
||||
During the Tournament, the Order of the Golden Duck has opened its catacombs for exploration by contestants. As you navigate through narrow corridors, you come across a large chamber, well-lit by sunlight streaming in through small windows at its peak. In the center lies a stone tomb with a plaque in front of it:
|
||||
|
||||
= Sir Enigmatus Encriptus =
|
||||
|
||||
Devised a method to communicate without the risk
|
||||
of message interception by messengers or enemies
|
||||
during the Great RAM (Realm Allocation Mayhem) War
|
||||
|
||||
Around the tomb, there are many books placed on pedestals. You check a few of them. In addition to the descriptions of the heroic deeds and accomplishments of the Golden Duck Order, you also find a book describing the method of message encryption. It turns out to be very simple yet clever!
|
||||
The message is hidden on a grid of characters. To read the message, you need to perform a sequence of rotations on every rotation point on the grid according to the message key.
|
||||
To start, you need to understand the concept of a rotation point. Each cell on the grid has neighbouring cells (including diagonals). The number of neighbouring cells depends on whether the cell is in the corner (3 neighbouring cells), on the edge (5 neighbouring cells), or elsewhere (8 neighbouring cells). A rotation point is a cell that has 8 neighbouring cells. Example rotation points on a grid are marked with R below, and their neighbouring cells are marked with N :
|
||||
NNN.. ..... ..... .....
|
||||
NRN.. ..... NNN.. .NNN.
|
||||
NNN.. ..NNN NRN.. .NRN.
|
||||
..... ..NRN NNN.. .NNN.
|
||||
..... ..NNN ..... .....
|
||||
To untangle the hidden message, you need to rotate the 8 cells surrounding each rotation point to the left or right according to the message key. Start from the top leftmost rotation point, continuing through all the rotation points to the right on the same row, then proceed to the following row, moving from left to right. Repeat this process until you reach the final rotation point on the bottom right. Note that the border cells are not rotation points, as they do not have 8 surrounding neighbouring cells.
|
||||
Below you can see the correct order for processing all 9 rotation points on the sample 5x5 grid:
|
||||
NNN.. .NNN. ..NNN ..... ..... ..... ..... ..... .....
|
||||
NRN.. .NRN. ..NRN NNN.. .NNN. ..NNN ..... ..... .....
|
||||
NNN.. .NNN. ..NNN NRN.. .NRN. ..NRN NNN.. .NNN. ..NNN
|
||||
..... ..... ..... NNN.. .NNN. ..NNN NRN.. .NRN. ..NRN
|
||||
..... ..... ..... ..... ..... ..... NNN.. .NNN. ..NNN
|
||||
There are 2 possible operations that can be performed on rotation points:
|
||||
R - rotate neighbouring cells by one item clockwise:
|
||||
ABC HAB
|
||||
HxD > GxC
|
||||
GFE FED
|
||||
|
||||
|
||||
L - rotate neighbouring cells by one item counterclockwise:
|
||||
ABC BCD
|
||||
HxD > AxE
|
||||
GFE HGF
|
||||
The message key contains a sequence of R and L operations that should be performed on all rotation points on the message grid. If the key is shorter than the number of operations required, you simply repeat the key as many times as necessary.
|
||||
The final message always starts after the > and ends before the < characters. These characters are always unique within the grid.
|
||||
You decide to practise decoding a sample message from the book (your notes), just for fun.
|
||||
Example based on the following notes:
|
||||
LR
|
||||
|
||||
>-IN-
|
||||
-----
|
||||
W---<
|
||||
The first line contains the message key: LR . You can repeat it as many times as needed, so in fact it looks like this: LRLRLRLRLR... . The rest of the input is separated by an empty line and represents the hidden message.
|
||||
To read the message, you need to perform the key operations sequence on the message grid. The sample grid is small, so there are only 3 rotation points. Below you can see the sequence of operations with the rotation points highlighted:
|
||||
|
||||
>-IN- -I-N- --I-- ----- -----
|
||||
----- >---- >W-N- >WIN< >WIN<
|
||||
W---< -W--< ----< ----- -----
|
||||
|
||||
start L R L end
|
||||
You can confirm that decoding is successful, because > and < are in the same line.
|
||||
In the example above the hidden message is WIN.
|
||||
What is the message hidden in the example you are analysing?
|
||||
|
||||
Part II
|
||||
|
||||
Of course, that was only an example showing the basic idea. The real messages had additional, misleading symbols which made the decoding process much more difficult. Additionally, processing the message according to the key only once was deemed insufficient, as it could be easily decoded by enemies.
|
||||
Standard messages assumed that the operations for the whole message needed to be repeated 100 times. Each time you start from the top left rotation point and from the beginning of the message key sequence.
|
||||
You find another riddle in the book (your notes), where the hidden message is the number of potions used by Sir Enigmatus Encriptus during the battle with the HTML (Hulking Tapestry Mighty Leviathan).
|
||||
Example based on the following notes:
|
||||
RRLL
|
||||
|
||||
A.VI..>...T
|
||||
.CC...<...O
|
||||
.....EIB.R.
|
||||
.DHB...YF..
|
||||
.....F..G..
|
||||
D.H........
|
||||
Below you can see all the rotation points highlighted for a single round of operations. You must visit them in order, from left to right and row by row, from top to bottom.
|
||||
|
||||
Result after 1 round of operations:
|
||||
.C...E.....
|
||||
..IB...YFB.
|
||||
.A..V...>TO
|
||||
.CH....I...
|
||||
.D.....FR..
|
||||
D.<.H..G...
|
||||
Results after 2, 3, 4, and 5 rounds:
|
||||
..C.V..F>.B
|
||||
A....B.I..Y
|
||||
.....E.F...
|
||||
.I<D.......
|
||||
.D...HG.T..
|
||||
C...H.OR... A....EB....
|
||||
...D..F..FI
|
||||
....C.G..BY
|
||||
V..D..O....
|
||||
.C..>HRH...
|
||||
I...<..T... ....C.....F
|
||||
...D.D.....
|
||||
.A...ERHB.I
|
||||
...C...G...
|
||||
VI...<THB..
|
||||
..F>..Y.O.. .....ED.B..
|
||||
A..C.D.G.H.
|
||||
......TH.F.
|
||||
C.FI..YR...
|
||||
..>V...<...
|
||||
......IB.O.
|
||||
Results after 97, 98, 99, and 100 rounds:
|
||||
....IECBV..
|
||||
..>......YF
|
||||
.A.....I.O.
|
||||
C.R.B.<.F..
|
||||
D..D.......
|
||||
..T.G...HH. ..........Y
|
||||
A...B.B.FI.
|
||||
...D.E..C.F
|
||||
I>T........
|
||||
C..DVG..OH.
|
||||
....R...<H. A..B.E.FC.I
|
||||
...........
|
||||
...D.....Y.
|
||||
....D...H..
|
||||
I..C.R.G.H.
|
||||
>.BVT.FO.<. ...........
|
||||
..B.D.F.H..
|
||||
.A.C.E.G.I.
|
||||
..B.D.F.H..
|
||||
.>VICTORY<.
|
||||
...........
|
||||
In the example above, the hidden message is VICTORY.
|
||||
Decode your message. What is the number of potions used by Sir Enigmatus Encriptus during the battle with the HTML?
|
||||
|
||||
Part III
|
||||
|
||||
The guard notices how adept you are with the arcane code and asks if you would like to try your hand at the official test. Every knight of the Order must pass it, so why not take this opportunity?
|
||||
The test involves deciphering another message written by Sir Enigmatus Encriptus from when he was on a reconnaissance mission and had to count the number of knights on Little Ending Island preparing legions for a huge invasion!
|
||||
The Order agreed to use 1048576000 rounds of operations instead of the regular 100 for such important messages!
|
||||
There is no way to do this by hand in a reasonable time; however, you have decoded the previous message, so you have something to experiment with.
|
||||
Decode your message. What was the number of knights on Little Ending Island?
|
217
2024/day19_encrypted_duck/src/lib.rs
Normal file
217
2024/day19_encrypted_duck/src/lib.rs
Normal file
|
@ -0,0 +1,217 @@
|
|||
use core::fmt::Display;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum ParseError<'a> {
|
||||
InputMalformed(&'a str),
|
||||
InvalidOperation(char),
|
||||
MessageTooSmall,
|
||||
NonRectangular,
|
||||
StartMarkerCount,
|
||||
EndMarkerCount,
|
||||
}
|
||||
|
||||
impl Display for ParseError<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::InputMalformed(e) => write!(f, "Unable to parse malformed input: {e}\nShould be the key, followed by an empty line, and the encrypted message."),
|
||||
Self::InvalidOperation(e) => write!(f, "Unable to parse {e} into an operation"),
|
||||
Self::MessageTooSmall => write!(f, "Message must be at least 3*3 characters"),
|
||||
Self::NonRectangular => write!(f, "All lines of the message must be of equal length"),
|
||||
Self::StartMarkerCount => write!(f, "There must be exactly one \'>\' in the message"),
|
||||
Self::EndMarkerCount => write!(f, "There must be exactly one \'<\' in the message"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
enum Operation{ Left, Right, }
|
||||
|
||||
struct Key {
|
||||
operations: Vec<Operation>
|
||||
}
|
||||
|
||||
impl<'a> TryFrom<&'a str> for Key {
|
||||
type Error = ParseError<'a>;
|
||||
|
||||
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
||||
let operations = value.chars().map(|c| match c {
|
||||
'L' => Ok(Operation::Left),
|
||||
'R' => Ok(Operation::Right),
|
||||
e => Err(Self::Error::InvalidOperation(e)),
|
||||
}).collect::<Result<Vec<_>, _>>()?;
|
||||
Ok(Self { operations })
|
||||
}
|
||||
}
|
||||
|
||||
struct Message {
|
||||
chars: Vec<Vec<char>>,
|
||||
width: usize,
|
||||
height: usize,
|
||||
}
|
||||
|
||||
impl<'a> TryFrom<&'a str> for Message {
|
||||
type Error = ParseError<'a>;
|
||||
|
||||
fn try_from(value: &'a str) -> Result<Self, Self::Error> {
|
||||
let chars: Vec<_> = value
|
||||
.lines()
|
||||
.map(|line| line.chars().collect::<Vec<_>>())
|
||||
.collect();
|
||||
|
||||
let height = chars.len();
|
||||
if height < 3 {
|
||||
return Err(Self::Error::MessageTooSmall);
|
||||
}
|
||||
let width = chars[0].len();
|
||||
if width < 3 {
|
||||
return Err(Self::Error::MessageTooSmall);
|
||||
}
|
||||
if chars.iter().any(|row| row.len() != width) {
|
||||
return Err(Self::Error::NonRectangular);
|
||||
}
|
||||
if chars.iter().map(|row| row.iter().filter(|c| **c == '>').count()).sum::<usize>() != 1 {
|
||||
return Err(Self::Error::StartMarkerCount);
|
||||
}
|
||||
if chars.iter().map(|row| row.iter().filter(|c| **c == '<').count()).sum::<usize>() != 1 {
|
||||
return Err(Self::Error::EndMarkerCount);
|
||||
}
|
||||
|
||||
Ok(Self { chars, width, height, })
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Message {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.chars
|
||||
.iter()
|
||||
.map(|row| row.iter().collect::<String>())
|
||||
.collect::<String>()
|
||||
.split(&['>', '<'][..])
|
||||
.nth(1)
|
||||
.unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
impl Message {
|
||||
fn permutation_cycles(&self, key: &Key) -> Vec<Vec<(usize, usize)>> {
|
||||
let mut grid = (0..self.height).map(|y|
|
||||
(0..self.width).map(|x| (y, x)).collect::<Vec<_>>()
|
||||
).collect::<Vec<_>>();
|
||||
(0..self.height-2).for_each(|y|
|
||||
(0..self.width-2).for_each(|x| {
|
||||
let step = y * (self.width-2) + x;
|
||||
rotate(&mut grid, x+1, y+1, key.operations[step % key.operations.len()]);
|
||||
}));
|
||||
let mut res: Vec<Vec<(usize, usize)>> = Vec::new();
|
||||
(0..self.height).for_each(|old_y|
|
||||
(0..self.width).for_each(|old_x| {
|
||||
let mut old = (old_y, old_x);
|
||||
loop {
|
||||
let new = grid
|
||||
.iter()
|
||||
.enumerate()
|
||||
.find_map(|(y, row)| row
|
||||
.iter()
|
||||
.enumerate()
|
||||
.find(|(_x, old_entry)| **old_entry == old)
|
||||
.map(|(x, _old_entry)| (y, x))
|
||||
).unwrap();
|
||||
if let Some(idx) = res.iter().position(|seq| seq.contains(&old)) {
|
||||
if !res[idx].contains(&new) {
|
||||
// assert!(res[idx].iter().position(|o| *o == old) == Some(res[idx].len()-1));
|
||||
res[idx].push(new);
|
||||
old = new;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
res.push(Vec::from([old, new]));
|
||||
old = new;
|
||||
}
|
||||
}
|
||||
}));
|
||||
res
|
||||
}
|
||||
|
||||
fn apply_permutation_cycles(&mut self, cycles: &[Vec<(usize, usize)>], count: usize) {
|
||||
let old = self.chars.clone();
|
||||
(0..self.height).for_each(|y|
|
||||
(0..self.width).for_each(|x| {
|
||||
let cycle = cycles.iter().find(|c| c.contains(&(y, x))).unwrap();
|
||||
let offset = cycle.iter().position(|ge| *ge == (y, x)).unwrap();
|
||||
let (new_y, new_x) = cycle[(count + offset) % cycle.len()];
|
||||
self.chars[new_y][new_x] = old[y][x];
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
fn rotate(grid: &mut [Vec<(usize, usize)>], x: usize, y: usize, direction: Operation) {
|
||||
let temp = grid[y-1][x-1];
|
||||
match direction {
|
||||
Operation::Left => {
|
||||
grid[y-1][x-1] = grid[y-1][x];
|
||||
grid[y-1][x] = grid[y-1][x+1];
|
||||
grid[y-1][x+1] = grid[y][x+1];
|
||||
grid[y][x+1] = grid[y+1][x+1];
|
||||
grid[y+1][x+1] = grid[y+1][x];
|
||||
grid[y+1][x] = grid[y+1][x-1];
|
||||
grid[y+1][x-1] = grid[y][x-1];
|
||||
grid[y][x-1] = temp;
|
||||
},
|
||||
Operation::Right => {
|
||||
grid[y-1][x-1] = grid[y][x-1];
|
||||
grid[y][x-1] = grid[y+1][x-1];
|
||||
grid[y+1][x-1] = grid[y+1][x];
|
||||
grid[y+1][x] = grid[y+1][x+1];
|
||||
grid[y+1][x+1] = grid[y][x+1];
|
||||
grid[y][x+1] = grid[y-1][x+1];
|
||||
grid[y-1][x+1] = grid[y-1][x];
|
||||
grid[y-1][x] = temp;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run(input: &str, part: usize) -> Result<String, ParseError> {
|
||||
if let Some((key, message)) = input.split_once("\n\n") {
|
||||
let key = Key::try_from(key)?;
|
||||
let mut message = Message::try_from(message)?;
|
||||
let cycles = message.permutation_cycles(&key);
|
||||
match part {
|
||||
1 => message.apply_permutation_cycles(&cycles, 1),
|
||||
2 => message.apply_permutation_cycles(&cycles, 100),
|
||||
3 => message.apply_permutation_cycles(&cycles, 1048576000),
|
||||
_ => panic!("Illegal part number"),
|
||||
}
|
||||
Ok(message.to_string())
|
||||
} else {
|
||||
Err(ParseError::InputMalformed(input))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::fs::read_to_string;
|
||||
|
||||
fn read_file(name: &str) -> String {
|
||||
read_to_string(name).expect(&format!("Unable to read file: {name}")[..]).trim().to_string()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sample() {
|
||||
let expected = ["WIN", "VICTORY"];
|
||||
for part in 1..=expected.len() {
|
||||
let sample_input = read_file(&format!("tests/sample{part}"));
|
||||
assert_eq!(run(&sample_input, part), Ok(expected[part-1].to_string()));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_challenge() {
|
||||
let expected = ["4877113951383767", "5529455775582299", "2423423664347316"];
|
||||
for part in 1..=expected.len() {
|
||||
let challenge_input = read_file(&format!("tests/challenge{part}"));
|
||||
assert_eq!(run(&challenge_input, part), Ok(expected[part-1].to_string()));
|
||||
}
|
||||
}
|
||||
}
|
5
2024/day19_encrypted_duck/tests/challenge1
Normal file
5
2024/day19_encrypted_duck/tests/challenge1
Normal file
|
@ -0,0 +1,5 @@
|
|||
LLRRLR
|
||||
|
||||
>+47++1+31++8+3+7<
|
||||
++++++++++++++++++
|
||||
8+++71+9++53+7++6+
|
23
2024/day19_encrypted_duck/tests/challenge2
Normal file
23
2024/day19_encrypted_duck/tests/challenge2
Normal file
|
@ -0,0 +1,23 @@
|
|||
LLRLLRLRLRLLRLRRLLRLRRRLLRLRLLLLLLRLRRRRRRRLLLRRLRLRRRLLLRLRRLLLLRLRRRLRRRLRRLLLRRLRRRRRLLLRLLRRLLLR
|
||||
|
||||
..+........+0..........M....OM.M.M.........MLK.W....
|
||||
+.........X.+........MK....0WM.NM.MKKMMMMMMXMMM.....
|
||||
.....2.M..+.W..0L.X...M...M.MM.MNM..M.MMMMMWMM......
|
||||
..........A...U.C+K..MMMKM..MM.MMM.MMMMMMM.NMMM.....
|
||||
..+.......;......<;.9.;ML...X.M0MM.MM.MMMMMMMMM.....
|
||||
..O.......X....DO9D.+KKOLM;.M.0MMM.MMMDM.MMMMM.0;..C
|
||||
N.9....................MM..MMNMMMMMMM;.MMM:...M.K;.X
|
||||
XX.CX.KDLC.......D...C..MM.MMM.M.M.MWOMDKM.KM.NMMO.K
|
||||
..+.W..MMM.WWN;.N+K+...DM.MMMMMMMWMMLXXMMMMMMWM.MN.O
|
||||
;....C.XOK..MMMMM...!...M.XMMXKMMKNWM..K.MMNCNMMMW.X
|
||||
..4..........Q..D+.+...WM.MOK.MWMMMMMMC.M.MM..X.MM.O
|
||||
..........2.........M...MMMMM.MMMM.;.M...N.M.M.MMM.;
|
||||
..+..+.D00.O.KXWX..KL...M..MMMMMMMMMOMMM.MOMK...MM..
|
||||
.........;..KO00K:.......M0M.MMMMKMMM0MM.M.M..MMMW..
|
||||
...............:.0X.0..KMXMMM..M.MM..M.MW;C.MW.MMK..
|
||||
..>..0....+X.....MWX....MMMM.;MM:WM.DM..MOMM:X0MWD..
|
||||
+.....MN......7K....MM..M.MM.OM0MMMMLKMWM.MM.X;MO...
|
||||
+...5.O++++.+++++..MW....MMMMMM.MMC..MW....M.MMO....
|
||||
....5...55N7.58.2CLWWM:MMMMM.0MMMMMK..MOMMXMMM.M....
|
||||
.....+.+++.+.+++5...OM.X.NMMMMN.O..:....N.M..W..M...
|
||||
....+...............NMM.WO.M.0....M.MW.W.M;M..OM....
|
79
2024/day19_encrypted_duck/tests/challenge3
Normal file
79
2024/day19_encrypted_duck/tests/challenge3
Normal file
|
@ -0,0 +1,79 @@
|
|||
LRLLRLRRRLLLRRRRLRRLRRLLLRRLRRLRLLLRRLRLLRRLLRRRRLRRRLRRLLLLRRRRLLRLLLRRLRLRRLRLRRRLLRLLLLRLRLLLLLRLRRRLLRLRLRLLLLLLRLRRLLRLRRRLL
|
||||
|
||||
EO..D..D..Y.EE..........E.O...V...........V..E...0.....DOE.C....D....................YDR.D...OVDCVR....RS.O....COYEO.Y.S.VD..E.DD..R.EE.S..YEEE..R.K..B...D...Y......OC....B..O...W...D..DC.ON...E..RV..
|
||||
...Y......YV..E........E.V.ESSE.....................XD.V..O.RCDE................R..W.NV.O.C..D.BCDE..Y...VO.:EL.SDBDDDSKEDEXE.OXBOO.S..O..CYOYEOY..................D.W.O...........YOCS.D..Y.EBEEO..V.O.
|
||||
..RDB..O....EV...K........COR....C...V....YSCE.OK.Y.DE.EE.E.....E.......W......VK.BD.O...D.YEDY.Y..:K.O.Y.C;XDDYVEOS.BRDDOEO.DDO.Y.C.D:BEKO.BYRR.ED...RE..O.N..D..B..BE....XDYB.C.DB.O...E.R.....Y...D..
|
||||
.....Y.......YY.........C..R.V....DD.......DV.R....CEVRY.....Y.O..................V...YD...DO.DOCW.WRE.BECOEEEO.OSEECYOCEVXCEEYWE.EOOYCB.CEYBODO...KOE....KE.E.C...OR....EVEEE.O.RERD.EEE.....Y.YO..S...
|
||||
.E.WE.LW....OE............YY.E...YSB.BC.EDD....VDE..O.......E.........R.N.....RE....O....C..E.Y.SE...ESDDEEOOEOESEVB....VE.EDSDBDD.E.DEEVRE..ES..V.D..DO.V:..R....DDYYNEEEB.D...DCDB.D............Y.....
|
||||
....EW.....R..............+R.E.Y..RR......E.EYY.....S..E.......O....V............L..OKYEED.KC...DEO.OD.BEREBRO..DBSB.RDR.ELORDR.BYEYCRO..YEDRO..C.Y.RYY...YR.....ERCO.D.EEEV.COO....E...R.......ED.O....
|
||||
..ODO..E..W.O....K.D.....++D.CRDVEEC.D.V.RE.....O.R.Y.D.E............VK.E......V..E..EY..DO.EY..DY.DSEDVOOYRSOR.RVEO.E.OV.BRDD.O.C...Y..RYVY.D...YDDOEE..BRV.E:.KCCE:..OBE..DEB..YYDLO.E.E..............
|
||||
..Y...0.EWE.B...............BE...BDEVE....Y.K.B.Y..E.V.R.E.D...Y...XRV..O..;.....YC.KCOE0S..E..DECOYC..O..EEB.YSYRSEEVCDYOSCEVE.DES.E..S.RXBYE...W...E..V;EBOV.EEEY.DYY...CK.Y.B.C..S.D.E...R...S.....Y.
|
||||
..S.......D.E......D..N.+....DEODOEEBE.EOR.W...OO.YYYSB.......B...R.O.RCX...VO...K.BOR.CDOCYD.D;YR.WO..R.YYYCVYXVYYRE.YNBRSVREDE.X..E..EEBCVEE.....BER.DYOBYYBEROYCD.WD.C.OOORY;RDOSVBCE.......D...V..CY
|
||||
V.W....X.O...E...........Y...VEVSYOCVS.O..O.0.Y...CDC......SVO....C.BY.0...Y;W....O...OE0D....WEOSBV.DRO.CDBYK.BEOSDORSCRCEDDCX.E.E.C...SVC.E.VVV.EERYEEVYYBRB....Y.DDO.C..BCO.V.E..EYO.....SY.....C..Y.
|
||||
.;E........YR.D.E..K...D..OORESYBCDEY.RDYY.C......ODO.C..R..D.R.....O.....COXDB..EYY.O...OYDY.EENRSNDEV.CYOCEDBV.WOESCO.D.ECELSER.E.D..SREVVRE....OYBE.EDDOBYE.YYE.OVCDDY.BOSDB..EDVBY.R..R....D....O..Y
|
||||
..D...0...S.....KRBO.EC0DYDS.VER.YEEEV..O.N.......YE.....C.YYDB...YOCX.D...0..D.....W.CDOO.....YYENC.RYYBSEB.CSYSYVBRCYD.YVY.EDED.....CYEEDEDOYRDCW.LDW.BVRREX.Y.OB.VOD.SW.C....B0S..EC...B.VDCS...O..V.
|
||||
.....Y.RO.C0WK..S.KYD.0...NE..RYBBVVB..YY......XV.........OOV.O.DEVYEEB..EVB.O......:YEO.C.OC.DD.BEO0EE..CO..SDDEEEDYEDCDOOE.0VEV.V..EOEORSEBYD..KREEX.ED.DY.RDB.DOVRDDB..OCV.DER.EKO......YY..D..EOEC.Y
|
||||
..Y...........6.DKCYDWX.E.BY..Y.KEYOD.OBW..Y.E..O.YS.....CRSSYOEBODV.EXE.RDR.EBE......O.X...OXRBOOE..DYDOR..V.EVVOSVYEED.RBC.BCREO..CYOWRSYBDSRV.ESE.;..V;O.YYV.YEBNOCR..X.KE.WES.C.......YVVSSS.K.E..O.
|
||||
...D...D....V.VBC...ECOYDOOE..WERREVVOE.K.O....V.CE.....D.SV.OEDCRY.CBE.BVEV.S.....Y.D.B......ROLSDSEEEC.N...ESRDYDOOSCDYOD.BSREYYC.R.RVOCOYEO.O.OYCB..E.....EY;ODSE.SVV..EEE.OEYC..E...OYBE..VORRVY.O.Y
|
||||
..ODC+..X...W....RKB....E0.Y.....DEE.R.W..KD....VSBCYD.B.DEY;BYVSCOD...R.O...EO.........RKE..YOVE.:R.DSEDO...DYSEEECEROVVOYOBDEDEDD...YRYDBDVCOOYSYO.C.EO.OOROYWSCE.BOB.YYDE...OE.......B.E.V.ED.CRY....
|
||||
CYE..E.O..KVY...DVR...YV.XEEK.BE.E.B.OVEXWD...RREOD.E.ORCVOERRESROY...E.OESW.D.....O...Y.DB....D.LNDDEVBVBE.BX.VCRYDEESERSBCEERVCSE.YBS..DVROS.RBDCEYRVE...E.DXEXD.YVESRE.ESD.OE....D..N:N.V...EEB.R....
|
||||
DVS.D..<....D....L...7......EO...S.E.W..:.RECVKEVYE.0E.EBY;ODYEEOSOC.E.EDCWYESB.......O.O..B...RWB..DYVSSEYYE.YCSYVEVEESDSROOYECEYE.K.YEY.DVEODCB..DDEEDEY.YC.W.EYSOOY..DODN.:B.....Y.......OVYE.B......
|
||||
YEY.......XO...BDKK.+.+...E.K.Y..YDRCEEY.Y.O.ECVDB....:YYDCEEECEDODWW.S....EYC.....C....0Y.Y...RESVSOLEDRE.SKDOOYEBOEVEEDCCDEO.EDVYEDOCD..VEOB.DRSYOESCEE.SYDLY.SK.:YY...C.EW............D.BCO.E.E......
|
||||
.VO.D.....C.+...D...6...V.V.YY...B.DE.Y.EE.YEDCDEE..EK.V..WRE.NEYSB.EC..DECXE.0.K.O...Y.......O.B.OD.SEDEERROBBCDCVSSEDDYBODCDDODESE.VEDBDOEDDCBOR.OYO.CDYVRCX;.DBEYO.D.C..V........L.....0.BY...C......
|
||||
..E............O...+.+...V0D.EDOE.YSVYEDKECY....BY.E.B.YKNODSSXYD.DOS..YV..:.Y....D...Y.OY........DSOCRERCEYYEODYDDVVDREYRVOBCSODREBDYSKXOVBVB.O:BDDEEEY..ORW...EOOCD....................VOD.D......DB..
|
||||
....E..O.E..Y...N..+4...C.C.EB.B..0BBO..OODB.OBESE+CE..Y.VCYS..OYOND.EYO.O.....O.RW...X..OYXXR..RYODEVEXDDSDYOORCEDYEVEEEEE.YROYERRCOSEOEOYB.Y.OBBYBOY...ORY.OY.BORED..YC........O.WC..0.EO..E..ES......
|
||||
.....S.Y.R....RY..+SOB.O.B.SOES2OK.EEY..D.RO.C..R.OO.O.OB:..E.YBC.N.EOEDV......Y.....L...O.K.E....DDY.YECCOOWSCYCBOOBCDOYEEDBDYBDR.LDDO.CYBVREYCKEDDDD..C.YB...BYBROEYD.Y.......V.CB.....YDO;S.RE....C..
|
||||
.........O..BEV..OE...O...R.SO.VE2.EDDEVE.EVOOCDDRRBKOO.WDOEEYSDV.CX..EDD.B.OCY.RY..R.DERB..EEEW...VVOC.DYSEDEDECEEEYBEDOREYRDR.RDWYE.YOEDVN:DDEEYO..C.O..ERWR..DYEVO.Y..........DOYY..E.Y..O.RY.D......
|
||||
..........EBVK..C.CEYO.EYS...CR.+.ROBR.YDXREDODERDCYC0DERE..DCEK...E..YYOVE.....Y.E.V.............K.C.ODCDYOYYBCDDYEDCOOSBEBYY.BEO0..SE.KONYVYS.VD.CDOC.DEBYOEB.REEOY.DR......Y.......EV.DV...YEE.......
|
||||
.........Y.KR..X.R3E..E.....DD.DOOEDOYDV.XSSSEYDBVDDCSD.VKEE0SOVVSCO.EDVES...KYEB...EOEOE.....Y...E.;.OSY;DEOKOOEOCEBEDCEOYVEOEOOYBBEVECDXVD.D.CRDDCY..EKB.O..Y.YRELD.E.........YDD.C..D....C.VOV.V.....
|
||||
..E...V..YLR.............R....:..XS.V.YO..VE.ECE.YOYO.N.DVOD.VREECBWDSB.D....;0...EWXBE.V....CVV...K...DO.OOOYDDECRYSDVEBEOYEE.ODC.OSRE.COEEE.O;....L...Y.RD.D..ORYCW....OD......XB..O.SYYC.V.EEE;E.....
|
||||
....OCR0...RWN......+V..+.Y.C.E..BEEDCDDOYCDO.YEDDVDESDYY:EOE.ODEY...VEE..........LWXEW.YRR.E.BV.O....YE..OEV0KCDDVVVVOOYOCEOYROB.BOYCB.O...YO.ESY...RWRY;.Y.:.REERW0OD.......:..E....X..E;EEE...EY.....
|
||||
..0.Y.......X.....1.Y..O.E....RE.DO...SXRN.BR..O.O.Y..OEOODE.EEODS.E...DE.SCY...V.EKYOBYC.OE.CEE.....S..EV.C.OOYCSDDDYEDEO.BDEDBOOYBCROYDSSVDOORD.:.O.B...Y...E.;.E.YCK.B.O...DYNEC..WEOEVO.EDBR.B......
|
||||
.W..Y0.D..V.C.....+.O.EE+...YY..VEYNEBOR.CYEDVE.OW.WYDO.EOYCVEEBBOSE...YO.NE........WVE.S.OKK.D..S....OR..BEE.VVODEY:SCESYEVSE;SORYRRYCVDE.Y.S.S.Y.R.YOE0S.E..XESSEYORC..;.....DBRO..O..E.YD....N.YOD...
|
||||
....O.B....D......E..........;....DR.BCE.DDED....B.E;.C.BDDOOCYRVBEO..Y...D.O....OYDRDO.DSDD.C.;E.E.DVEYDV..KYSOE...EVDSO..EESDSYVYYEYVODE.R..C.O.EOE.E.......BY.K.DC..YR.....RSEOO.DC.B..Y.E.X..B......
|
||||
..K.B..Y..V..........+..6.......O.D.E..;YDEBOY.SV..OED.VEO.YYEREEEED.....O.R.B.R..R.EE..E.C..R...Y...OO.....D.CD.VDSDEYDCOVEESEORCEC.YEDRO.D.....EYC.O.K.V..OO...V.SCE.........DRCX..........RY.....D...
|
||||
ECCDX.X.ESX...........E.....O.E.D;VW...BOOE.O.VOEYX+E....ORBBYR.SNCYO.Y.....YB.Y.EO.K.WV.O.S.E.......EO.....BSE...EOYRVVYBEEDDCRYOY.YOEYYEEV..SECECDE..O.R.R..YV.S.CO...Y.D.EWBYECR...RB....B..ONV.RES..
|
||||
.XW...EEE.X..........E.........DBB.OD.NEEEYDYODYEOEOY..EO..EYYDEDOBCC.DV.RCVYR.B...NE...K.Y..E.........EN.W.B.ECE..SODBRSEVOESO.VYBOCVVEYBBC...;.YO..Y.O.O...K..OS;.EV.EVO..W.O.E:.....Y....Y.DO.N..EX..
|
||||
...;..BE...........W..........E.W....Y.BCYCE..;BDSY+C....3S.EVEDBDOYOOV...E.O;.OV.R.VY.V...R.......C.X........DYSD.DOYSYVBYEEDEE...DOYVOYDEE..DDYCE......Y.D..:S.E..B.O.V.D:CYOB:D.....R.XO.....V.....EN
|
||||
...WWOE.....L........E...EYB..RVLCYCO.C..EEOY.VEDDE+EE..S.XE.EEE.0YECEOV.ERDDCD...Y.S..YKYE.B..E...C.C..;.D...OCYOVECY.DEDVDOOO..YBDEVDS...YYRR.ERDR.......LEOX.DVVESCODYO...;C.K.....E.DB.....D......VK
|
||||
.R......O...............O.....O.ONN..X...DK.DEWOYDE+B+4XO.BSO.ESDDEYORDERDCSOV.YC..N..YVC.ED.EE.....LOK.......DCSCYEDEE.Y.YSSED.ER.OE.E.YCC.....VNX.....DEW...E.OCVDV.DDDY..O..O;D.....YDYC..R..Y;.O.NC.
|
||||
..V..K0.V...E....YD.....OYD..............VRRR.Y.DYOWOBOSYKYYODE..0CEE.VD.OEEOEERC.E..W.O..N.D.........N.O.E....YEDCYOY..YSDDODYEYVR..XE..0..DVV.YE.......KOS.NE..YCYVCV.OR...C..O...V.......EE.DE....CC.
|
||||
0.....Y..........E.O...............R.O..D.D.OD..CODVYKX..KEKXDE.ODSDOSB..YSXESOEV..VDBD...EL.;........N;S......O.DDOSO.OC.BROO.BEDDRCDSKEOEDE...D..............WVOBYE.EOS.Y.E.YDYO..+.BYY.O..O......NN..
|
||||
........DY.....DOD.......................SDYB...SOORYE.RYDSEC0O..RDYS....X..RVDSE.S.B.BYE.....C....W.X..........SOOYDDECYC.E.S.OEOED.DER...ED..............C.VDO.DDOBODCES.....ES...+...E..W..ROVR..WO..
|
||||
EE.................E.......B...D........YE..S0EVDOEOCYEC.D+O..D.DEE.RO.0..DDCEDVOOK....S.......R.................EVOYBDY.VEVOD.RYCRVY.O.Y.E..;..............E.KR.;O.DEYYS..BS.BE.Y++...Y....L.B..Y.O....
|
||||
D.E...CYO.......................E.O.....R..DY.E.DSO..B...S.0SCE.....D.YK.....YORBER.0EY.C..R.O..E.;............VCYEYOVCEDD.OYEYE..EEDYO...D.BOW............Y.D.E.....B.EC.OV....V.+..E..........EEY...:.
|
||||
VEO.K..............X..RL..N....BO...X.....X.OODRCDEBX.V4K3EDE..+LDVSERSYDOYEBDYEEVR.........W....YE.............BDE.VNOD...SYSEYDOECDVB.ESE........S..............O.RDRWORD.B.....+++.OR...E....VBC.....
|
||||
B.NRV..................YSR.....E..E....D....O..EDOE....0.OW.E..2.YD...ERDOYNE..DCY.E.E.....OB.CD..................CYEODE..EEDE...EDEOSDYS.V...K.O.DEK0...B.DL.VV.YD..O.N.DESC..O....O.K...V....EVYR.X.D.
|
||||
ERYRV........E........EY...........E.V.S.....BEO.O.Y.S...BRO..YE.OYB..EYEYR.R.VOEYE..Y..YR.O....D.K....C..........D.OC.E.ERVBDOODDECYOR.S.....S.D.EE...S.O.V..E.ODO....V.EBC.C.........B......E...VDR..B
|
||||
EVERE.........E.V.....S..E..S.E...L....V........O.R.VV.W...BV....EE.E.DYV.D..EYDVO..YB.......Y................OY..OECW0ESEYREEBOOEYWBRV.EV.....EECKE...D.E.OSDK.CKYSY.YO.YODDB......E..B.......OCDO.EDRE
|
||||
V.Y.DV.......VE...........VEV.E..............:.D...E.RRD34..C...CEES.CVCOS...VE..S.C.S...BE.L.EOO............E....O.SYV..SROEYEOVOEYDYE.B.....DV..N....E.SS.S.Y.DEBCO.O.E...Y.O.............V.ODE.OKBLR.
|
||||
.K.OVY.O.....O..O..V.S...X....E..............R..N...EBV.+.O.C...X.O.VYCS...E.CYSCOOD.EV.E.V..........YO..O..CYO.....YYEE.ECYEBVBBESDCEC.YS.RV.O..E;ES.DCS.ROECS.YEOBD.D..O.E.CC....CB........V.ORD.0DY..
|
||||
....EB........L..RVY.E.....E...OL...O..........YRYX..E.D...V....R...SR:0R.SE.EC....YV.....S...DYW.O......O..........OO.OSEYOREEDVEOCDEOYY.......K.EDY.CY:S..VODB...B.E......E.......D.......C.R.S.EDV..D
|
||||
E.RCE..Y....D........E........D.....R.......CO.DE.VOEEE.S.E......X..O.EB.OYC....C.BCY.O.....RYE.EB.CYD..............OBSCEEYRSYYSESOEDSVRDDR.EE...DW...CEO...O..EO0;EBSO.Y.ESYV.S..E.....Y....E:.EOSEYEYE
|
||||
..Y.....Y.O.C.W...K...W.........O........O.....DECSV.S.ELC...W..V...YB.W.O..OOCVE.REODY....V....W.E................O.R.SVDEY.YYCEDOYCEBDYC.S.Y.....SW.DV....R.O...NY...NERDOR.Y....E.....DYDE...OOEER.VV
|
||||
.CBO........D.............E.K...............Y...E.SOEED..:S.......YO..KC..DYE..DYS.YECE...VRB.................S.....DDYED..Y:DBEODRECOE.DSD..Y........Y.....R.VYL;KYYCEVYEB.VR.R........YO...YVVBEVECEEE
|
||||
DECD.......................................O....D..E...W.........ONOYC.D......DBV.YDOC....................R.........D..YRRCOSODEYODODDRD....W......D0.........COEO.YYE.EY.EEX.O.V.R.....C..YDEY.EED.O..Y
|
||||
.YOE.............................S...E........VK..SDE.RDD..........SE.XS..BX.B.BOWDEV.RBB............E.....Y.V........OYSR.LDE.ECEERERB.EO.........O.K0....S..YD.YYOYYEKRCOV...BO.X.......O.CBVYYCSO....
|
||||
..C...................................E.D.....RD...EY........OO..Y.YDS.V..Y.OD.CRDDSENO....O.....E........;E.........E.EEEYCDYRV.OBEYY..EXO.D........ODYE...C.ODDBBYBD.S.DBSOYEYL.E....S..ORYO.BBOY.::..
|
||||
EE..........................R........DC.........O..B...YCOB...S.D..B..ER...DYCODDOOYE..OD.........V.Y.....K..R....:...EYE.DBDC...EDRE.....Y..........OD..R.SDE.BKYOOYOEOEDY..D.....Y.V.D....EROWBEDC.E..
|
||||
..D..........................EEYR....Y..C....C..E..E.........Y.CR.E....BOD..ODESEDEC.YOOVO.......OE...........B.V.......ECBEV...SEXY........K........OCDDOEYE.EOCYROEESBRSVB.OE..RB....D..EDOE.BO.......
|
||||
...................E........YE...........D.O.Y0.Y.SD..BEOO.Y...YKK.....ODYC.DESEEYE.EBDWDE.BV..E.O..Y....E...B..........S.ER.C.OODB.O...C..V..........Y.DOBYYVVE.EYRRBDYOOD.OCE....O.....EDC.VE:YEVC.E.Y
|
||||
..COB...............DOO.....R..OXEE.Y......O.O..EVSD.DB.R.CN......L.C.WDY.O.ESERESYERDSVOESX.........O.V.E...........W..VDLDB.BBREEYEE....DYN..O......B;.O..CRSEOOCEDDBY.YRXYRO..EBR....O.E..E.D.Y......
|
||||
WRY...V...Y........CS.....K...D.BDY.D...Y......DOS..D.VBECVDRV......B..YCO.ESEVEY.OEDYC.OYRYN..SE........O..............S.R0Y..VEBEOO.ODE.YY..V.........DODWCDEODYVDECROVB...D...OBDR....C.....OLO......
|
||||
VEO.R......O.Y.....D..R..........V.;O..X...B..E.Y....O.E...EEE....Y.S.D.O.ESEVESRBOOYDNBEBOEO.R.Y...........E..E..EVS.......VE.RREODEDDS.COXY.D..DW.B..YKVY.OXC.CBYBCEVR.0YYES.Y.S..V....SE....O...C....
|
||||
EDE.......YB...........E.XO......V.W.DEV.B...RYY........N.YR.K.........Y.YDY..DESEOR..COEO..E.K.Y..............E.............OVOB.EYDREBYERYBOO.......V.YODEBOEDV.CROOD..BSYEB.O.O.D......E....V.D.K..R.
|
||||
.VD.B.....V..R....V........V.....B.RS0R.BD.B...EE........O.V..Y.......YDO.YBODYCO.KY.OKYYOBV.........Y....................N.CD.Y.OYYOBSOREOO.VO...EB..DCEY.XYDD...DCDDDS.DDVEO.YYEX.....O.....S.......K.
|
||||
..E...........R.E.V.;.......ERE...BEEOBEOEED....D.........XWERC.C.....Y.YCER..ONK..0X..DEV.....N..............V0..O.O.Y.O.........ESRDYYEYSYE.YR.E.Y....CYYEYC.K.EYDE...OOEVEEYE.S..K....S.....BYDS.....
|
||||
....E..V.R..B...E.E........E.......EBE..EEYY..Y.......................B.E.D.OREL.....O.R......E....E..............X.KO.....R.E...BCYSYEODDVOREC..D.O..DOBD.CO.E.BOVBCVE..COYEC.B.....B..C.....CD........
|
||||
.....XEE.B...BD.....YO.....VYE.....BR;OECYEE..........D.....R...X..DLEE...SE.0V.....V.K........Y.X............C.B.>.+OX.B.......O.E.DYRYSORRCECC.....YYR.RR.EBOEOYNDVOBO.BRDEY.EE..RD.E.RB.YE.E..YEDE.C.
|
||||
...E...O.Y..ROS.................X..BR.VKSREBY.C...........KB....KVDW.E.O....0....................................B.YD........YEE.NYVODSOYCBBCDDV.O..X.Y..S.ERR..SEBVES.YBOVDSC.D..OB.VO.O.......O.RSB.E.
|
||||
....BV0...YSEY....BDD........X.....KEX.EDOSVO.R..DS......WR...WY.....Y.....N................YE.........Y........EE......0..E..E.OO...EBYVEBBYBEDS..REY.......DY.SEVSRDDYVDDDOD.E..YVNE..EOE.EE....YE..D.
|
||||
...EEO.D.OS.E.................V..EO.D.SYEDSXEDD..........D.D.....DX...B.................E0.......X......R.V.....VO.VEE..Y....YE.RC;BDDREDDRY.Y.SYO...ES.....B.EDVEVSSO.EEVOEEYDS.DY.B..EDE.Y.Y.....O....
|
||||
..YDYO...VEE....................X.DDOO.E..EESCS...O0.....V.O.WEDYD...Y...............W......E.S........KL.........E.E.R.Y.....Y.E.EO0E;CDEDOEDOYOO....V....K.DE0RCRYVDEOO..BEBYE...SY.Y.OSE..O.....S.Y..
|
||||
SOEYOE.D...EE.VR.........W....K.EE.RB.EBREVOY.OD.W.......CYE.E..YD..................D.X.V....N.V.R.....D..E....S....DO........V.SEOVCOS.EBEBEY.YBY..B.....R...0WYCEEVE.BOOOEDY.YR.YEE.............R.O...
|
||||
OEOYCBRB....R.0...........ENV......OYYE.CKEYE............V.WVO.O.......................K..YW..EEE..........S.S.V...............EBD.DVY..EVSOEYDCD....D.....EOY....BREEOWED.BODDD..ORESE.LBV.Y........DX.
|
||||
YDEEEBYD..Y.O.V...........:..CY..KR...OYOVEOYD............RV...C.DKE..............C....OWS...NE.C.....W........E.....C.Y........EYEEYD.OCEEC:R.ORSE.C.....EO..ECOODO.E.EEVCEEROYE..0....YC.D....O.EOY..E
|
||||
YVBRODEW....................C.....ELN..E.NDEV...........C..YRBDO........R................OYXYXW...B.W.D...........X.B.D.......RDYDEVVYYS.DDE.SE.C.Y.R..YO.V..R.LY.EO.REVECERVORBY.D..W......D.C.......B.
|
||||
ROSVVCOEE.B..................D.L...W..NOSNBO..........BV...YOB.O...Y..................E.KEV.K.........O..........K.D...N........O.ODDD.BYEDSES;..CB.Y.........C.DOY.L.RYERBCDXCOK:..:L.D.ORE........B.SO
|
||||
OYYOD.ERBK.......K.....0........K0LK.W.K:..N.......R.E.....DCY.O....B..................ESLX.YX......................R..........EVYO.RE.V.V...VDODEE.O.OOEE.......YV..OO.SEDOOEVY..E.................ODD.
|
||||
BYOB..DED.B........X............;........:.E........R..E....YED....D.E...................EEWN......................E.O.........R.CODY..DE..V.C....O.Y........C...C...Y....D.OOC...W........D........EBEE
|
5
2024/day19_encrypted_duck/tests/sample1
Normal file
5
2024/day19_encrypted_duck/tests/sample1
Normal file
|
@ -0,0 +1,5 @@
|
|||
LR
|
||||
|
||||
>-IN-
|
||||
-----
|
||||
W---<
|
8
2024/day19_encrypted_duck/tests/sample2
Normal file
8
2024/day19_encrypted_duck/tests/sample2
Normal file
|
@ -0,0 +1,8 @@
|
|||
RRLL
|
||||
|
||||
A.VI..>...T
|
||||
.CC...<...O
|
||||
.....EIB.R.
|
||||
.DHB...YF..
|
||||
.....F..G..
|
||||
D.H........
|
0
2024/day19_encrypted_duck/tests/sample3
Normal file
0
2024/day19_encrypted_duck/tests/sample3
Normal file
Loading…
Add table
Add a link
Reference in a new issue