aoc

My solutions for the Advent of Code
git clone https://git.tronto.net/aoc
Download | Log | Files | Refs | README

commit 9479971937ce37d5e7f2d6813b5af9087fdc9d3e
parent 1bc1f289b027f13f4e557ab9398c9ab618cc52cd
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Tue,  8 Jul 2025 17:10:53 +0200

Day 22 2022

Diffstat:
A2022/22/a.rs | 81+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A2022/22/b.rs | 314+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A2022/22/common.rs | 111+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A2022/22/input | 202+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A2022/22/test | 14++++++++++++++
5 files changed, 722 insertions(+), 0 deletions(-)

diff --git a/2022/22/a.rs b/2022/22/a.rs @@ -0,0 +1,81 @@ +use std::cmp::max; +mod common; +use common::*; + +#[derive(Copy, Clone, Debug)] +pub struct Position { + pub i: usize, + pub j: usize, + pub d: Direction +} + +pub struct Map { + pub tiles: Vec<Vec<Tile>> +} + +type StepFn = fn(&Map, Position) -> Position; + +impl Map { + pub fn from_stdin() -> Map { + let mut maxlen = 0; + let mut tiles = vec![]; + let mut line = String::new(); + while std::io::stdin().read_line(&mut line).unwrap() > 1 { + let v = line[0..line.len()-1].as_bytes().iter() + .map(|b| Tile::from_byte(*b)).collect::<Vec<_>>(); + maxlen = max(maxlen, v.len()); + tiles.push(v); + line.clear(); + } + for v in &mut tiles { + while v.len() < maxlen { v.push(Tile::Skip); } + } + Map { tiles } + } + + pub fn start_position(&self) -> Position { + let first_valid = self.tiles[0].iter() + .position(|t| *t == Tile::Walk).unwrap(); + Position { i: 0, j: first_valid, d: Direction::Right } + } + + pub fn walk(&self, pos: Position, n: usize, step: StepFn) -> Position { + let mut p = pos; + for _ in 0..n { p = step(self, p); } + p + } +} + +fn step(map: &Map, position: Position) -> Position { + let imax = map.tiles.len(); + let jmax = map.tiles[0].len(); + let s = position.d.step(); + let mut p = position; + loop { + let inext = ((s.0 + imax as i64) as usize + p.i) % imax; + let jnext = ((s.1 + jmax as i64) as usize + p.j) % jmax; + p = Position { i: inext, j: jnext, d: p.d }; + match map.tiles[p.i][p.j] { + Tile::Walk => return p, + Tile::Wall => return position, + Tile::Skip => () + } + } +} + +fn password(p: Position) -> usize { + 1000 * (p.i+1) + 4 * (p.j+1) + p.d.value() +} + +fn main() { + let map = Map::from_stdin(); + let (turns, steps) = read_instruction_line_from_stdin(); + let mut position = map.start_position(); + + for i in 0..turns.len() { + position = map.walk(position, steps[i], step); + position.d = position.d.turn(turns[i]); + } + position = map.walk(position, steps[steps.len()-1], step); + println!("{}", password(position)); +} diff --git a/2022/22/b.rs b/2022/22/b.rs @@ -0,0 +1,314 @@ +use std::mem::swap; +mod common; +use common::*; + +// Use 4 for the test input, 50 for the real one +//const CUBE_SIZE: usize = 4; +const CUBE_SIZE: usize = 50; + +// Connections between faces to make the cube 3D. +// This is hard coded to work for my specific input. +// To make it work for a different input you have to change this. +// The faces are in top-to-bottom, left-to-right order of input. +// For each face, the 4 connections are in order right, down, left, up. + +// Test case. Configuration: +// 0 U = 0, D = 4 +// 123 R = 5, L = 2 +// 45 F = 3, B = 1 +/* +const CONNECTIONS: [[Connection; 4]; 6] = [ + // Face 0 = U + [ + Connection { face: 5, side: Direction::Right }, + Connection { face: 3, side: Direction::Up }, + Connection { face: 2, side: Direction::Up }, + Connection { face: 1, side: Direction::Up }, + ], + + // Face 1 + [ + Connection { face: 2, side: Direction::Left }, + Connection { face: 4, side: Direction::Down }, + Connection { face: 5, side: Direction::Down }, + Connection { face: 0, side: Direction::Up }, + ], + + // Face 2 + [ + Connection { face: 3, side: Direction::Left }, + Connection { face: 4, side: Direction::Left }, + Connection { face: 1, side: Direction::Right }, + Connection { face: 0, side: Direction::Left }, + ], + + // Face 3 + [ + Connection { face: 5, side: Direction::Up }, + Connection { face: 4, side: Direction::Up }, + Connection { face: 2, side: Direction::Right }, + Connection { face: 0, side: Direction::Down }, + ], + + // Face 4 + [ + Connection { face: 5, side: Direction::Left }, + Connection { face: 1, side: Direction::Down }, + Connection { face: 2, side: Direction::Down }, + Connection { face: 3, side: Direction::Down }, + ], + + // Face 5 + [ + Connection { face: 0, side: Direction::Right }, + Connection { face: 1, side: Direction::Left }, + Connection { face: 4, side: Direction::Right }, + Connection { face: 3, side: Direction::Right }, + ], +]; +*/ + +// Input. Configuration: +// 01 +// 2 +// 34 +// 5 +const CONNECTIONS: [[Connection; 4]; 6] = [ + // Face 0 = U + [ + Connection { face: 1, side: Direction::Left }, + Connection { face: 2, side: Direction::Up }, + Connection { face: 3, side: Direction::Left }, + Connection { face: 5, side: Direction::Left }, + ], + + // Face 1 + [ + Connection { face: 4, side: Direction::Right }, + Connection { face: 2, side: Direction::Right }, + Connection { face: 0, side: Direction::Right }, + Connection { face: 5, side: Direction::Down }, + ], + + // Face 2 + [ + Connection { face: 1, side: Direction::Down }, + Connection { face: 4, side: Direction::Up }, + Connection { face: 3, side: Direction::Up }, + Connection { face: 0, side: Direction::Down }, + ], + + // Face 3 + [ + Connection { face: 4, side: Direction::Left }, + Connection { face: 5, side: Direction::Up }, + Connection { face: 0, side: Direction::Left }, + Connection { face: 2, side: Direction::Left }, + ], + + // Face 4 + [ + Connection { face: 1, side: Direction::Right }, + Connection { face: 5, side: Direction::Right }, + Connection { face: 3, side: Direction::Right }, + Connection { face: 2, side: Direction::Down }, + ], + + // Face 5 + [ + Connection { face: 4, side: Direction::Down }, + Connection { face: 1, side: Direction::Up }, + Connection { face: 0, side: Direction::Up }, + Connection { face: 3, side: Direction::Down }, + ], +]; + + +#[derive(Copy, Clone, Debug)] +struct Connection { + pub face: usize, + pub side: Direction +} + +struct Face { + pub tiles: [[Tile; CUBE_SIZE]; CUBE_SIZE], + offset_i: usize, + offset_j: usize +} + +#[derive(PartialEq, Debug, Copy, Clone)] +struct Position { + f: usize, + i: usize, + j: usize, + d: Direction +} + +#[allow(dead_code)] +impl Face { + pub fn empty() -> Face { + Face { + tiles: [[Tile::Skip; CUBE_SIZE]; CUBE_SIZE], + offset_i: 0, + offset_j: 0 + } + } + + pub fn is_empty(&self) -> bool { + self.tiles[0][0] == Tile::Skip + } + + pub fn print(&self) { + for i in 0..CUBE_SIZE { + for j in 0..CUBE_SIZE { + print!("{}", self.tiles[i][j].to_char()); + } + println!(); + } + } +} + +struct Cube { + pub faces: Vec<Face> +} + +type StepFn = fn(&Cube, Position) -> Position; + +impl Cube { + pub fn from_stdin() -> Cube { + let mut faces = vec![]; + let mut line = String::new(); + let mut offset_i = 0; + while faces.len() < 6 { + let mut row = [Face::empty(), Face::empty(), Face::empty(), + Face::empty(), Face::empty(), Face::empty()]; + for k in 0..CUBE_SIZE { + let _ = std::io::stdin().read_line(&mut line); + let bytes = &line.as_bytes(); + for l in 0..line.len()-1 { + row[l / CUBE_SIZE].tiles[k][l % CUBE_SIZE] = + Tile::from_byte(bytes[l]); + } + line.clear(); + } + let mut offset_j = 0; + for mut r in row { + r.offset_i = offset_i; + r.offset_j = offset_j; + if !r.is_empty() { + faces.push(r); + } + offset_j += CUBE_SIZE; + } + offset_i += CUBE_SIZE; + } + let _ = std::io::stdin().read_line(&mut line); // Read empty line + assert!(faces.len() == 6, "Cube has {} faces", faces.len()); + Cube { faces } + } + + fn start_position(&self) -> Position { + let j = self.faces[0].tiles[0].iter() + .position(|t| *t == Tile::Walk).unwrap(); + Position { f: 0, i: 0, j, d: Direction::Right } + } + + pub fn walk(&self, pos: Position, n: usize, step: StepFn) -> Position { + let mut p = pos; + for _ in 0..n { p = step(self, p); } + p + } +} + +fn flips(d1: Direction, d2: Direction) -> bool { + match d1 { + Direction::Right | Direction::Up => + d2 == Direction::Right || d2 == Direction::Up, + Direction::Down | Direction::Left => + d2 == Direction::Down || d2 == Direction::Left + } +} + +fn swaps(d1: Direction, d2: Direction) -> bool { + match d1 { + Direction::Right | Direction::Left => + d2 == Direction::Up || d2 == Direction::Down, + Direction::Up | Direction::Down => + d2 == Direction::Right || d2 == Direction::Left + } +} + +fn validate_connections(conn: &[[Connection; 4]; 6]) { + for i in 0..6 { + for j in 0..4 { + let c = conn[i][j]; + let d = conn[c.face][c.side.value()]; + assert!(d.face == i, "Bad connection: face {}-{}", i, j); + assert!(d.side.value() == j, "Bad connection: side {}-{}", i, j); + } + } +} + +fn overflow(i: i64, j: i64) -> Option<Direction> { + if i == -1 { return Some(Direction::Up) } + if j == -1 { return Some(Direction::Left) } + if i as usize == CUBE_SIZE { return Some(Direction::Down) } + if j as usize == CUBE_SIZE { return Some(Direction::Right) } + None +} + +fn on_other_side(i: i64, flip: bool, positive: bool) -> usize { + const CUBE_SIZE_I64: i64 = CUBE_SIZE as i64; + (if i >= 0 && i < CUBE_SIZE_I64 { + if flip { CUBE_SIZE_I64 - i - 1 } else { i } + } else { + if positive { 0 } else { CUBE_SIZE_I64 - 1 } + }) as usize +} + +fn step(cube: &Cube, p: Position) -> Position { + let s = p.d.step(); + let mut inext = s.0 + p.i as i64; + let mut jnext = s.1 + p.j as i64; + + let ret = if let Some(d) = overflow(inext, jnext) { + let conn = CONNECTIONS[p.f][d.value()]; + let flip = flips(p.d, conn.side); + let new_direction = conn.side.opposite(); + let positive = new_direction.is_positive(); + if swaps(p.d, conn.side) { swap(&mut inext, &mut jnext) } + Position { + f: conn.face, + i: on_other_side(inext, flip, positive), + j: on_other_side(jnext, flip, positive), + d: conn.side.opposite() + } + } else { + Position { + f: p.f, + i: inext as usize, + j: jnext as usize, + d: p.d + } + }; + + if cube.faces[ret.f].tiles[ret.i][ret.j] == Tile::Wall { p } else { ret } +} + +fn password(cube: &Cube, p: Position) -> usize { + let f = &cube.faces[p.f]; + 1000 * (p.i + f.offset_i + 1) + 4 * (p.j + f.offset_j + 1) + p.d.value() +} + +fn main() { + validate_connections(&CONNECTIONS); + let cube = Cube::from_stdin(); + let mut position = cube.start_position(); + let (turns, steps) = read_instruction_line_from_stdin(); + for i in 0..turns.len() { + position = cube.walk(position, steps[i], step); + position.d = position.d.turn(turns[i]); + } + position = cube.walk(position, steps[steps.len()-1], step); + println!("{}", password(&cube, position)); +} diff --git a/2022/22/common.rs b/2022/22/common.rs @@ -0,0 +1,111 @@ +use std::cmp::*; + +#[derive(PartialEq, Copy, Clone, Debug)] +pub enum Tile { Walk, Wall, Skip } + +#[allow(dead_code)] +impl Tile { + pub fn from_byte(b: u8) -> Tile { + match b { + b'.' => Tile::Walk, + b'#' => Tile::Wall, + b' ' => Tile::Skip, + _ => panic!("not a valid tile {}", b) + } + } + + pub fn to_char(&self) -> char { + match self { + Tile::Walk => '.', + Tile::Wall => '#', + Tile::Skip => ' ' + } + } +} + +#[derive(PartialEq, Copy, Clone, Debug)] +pub enum Direction { Up, Down, Right, Left } + +#[allow(dead_code)] +impl Direction { + pub fn from_char(c: char) -> Direction { + match c { + 'U' => Direction::Up, + 'D' => Direction::Down, + 'R' => Direction::Right, + 'L' => Direction::Left, + _ => panic!("invalid char for direction") + } + } + + pub fn turn(&self, t: Direction) -> Direction { + match t { + Direction::Right => match self { + Direction::Up => Direction::Right, + Direction::Right => Direction::Down, + Direction::Down => Direction::Left, + Direction::Left => Direction::Up + }, + Direction::Left => match self { + Direction::Up => Direction::Left, + Direction::Left => Direction::Down, + Direction::Down => Direction::Right, + Direction::Right => Direction::Up + } + _ => panic!("cannot turn up or down") + } + } + + pub fn step(&self) -> (i64, i64) { + match self { + Direction::Up => (-1, 0), + Direction::Down => (1, 0), + Direction::Right => (0, 1), + Direction::Left => (0, -1) + } + } + + pub fn value(&self) -> usize { + match self { + Direction::Right => 0, + Direction::Down => 1, + Direction::Left => 2, + Direction::Up => 3 + } + } + + pub fn opposite(&self) -> Direction { + match self { + Direction::Right => Direction::Left, + Direction::Left => Direction::Right, + Direction::Up => Direction::Down, + Direction::Down => Direction::Up + } + } + + pub fn is_positive(&self) -> bool { + *self == Direction::Down || *self == Direction::Right + } +} + +pub fn read_instruction_line_from_stdin() -> (Vec<Direction>, Vec<usize>) { + let mut dir = vec![]; + let mut step = vec![]; + let mut line = String::new(); + let _ = std::io::stdin().read_line(&mut line); + let mut i = 0; + while i < line.len()-1 { + match line.chars().nth(i).unwrap() { + '0'..='9' => { + let j = line[i..].find(|c: char| !c.is_digit(10)).unwrap() + i; + step.push(line[i..j].parse::<usize>().unwrap()); + i = j; + }, + c => { + dir.push(Direction::from_char(c)); + i += 1; + } + } + } + (dir, step) +} diff --git a/2022/22/input b/2022/22/input @@ -0,0 +1,202 @@ + ..............#....#...........#.................#....##..#...........................#............. + ..............#....#.#......#......#.........................#....#...................#......#...... + .......#...........................#...#.....#..............#................#.......#.......##..... + .........#.......................#.#.#.....#.........#....#.......#.#....#................#.....#..# + #..........#..............#...........##................#.#.....#....#.............##....#........#. + ........##.....#..#........#.........#................#.#..........#........##.......#...........#.. + ............#......##....#....##.........##......#..#......................................#........ + ..#....#...............#.....................#.#...................................#....##.#.....#.. + .#.................#......##...........................#........#..#.....#.......#...#......#.....#. + ........#.....#...........#..........#.....#..#..............#...............#............#..##...#. + ..........#............#.#..#.......#......#..#...............#......#.............................. + .#......##........................#............#....................#................#..#........... + ..........................#..#.........##.........................#......#..#....#..............#... + ..........#..........#...............##..........................#....##.....#.............#..#.#... + ...#...............#.#.........#....#............#...#.....##.............#...#.#...#........#.....# + .........#.............#.........................................#...#...#..................#.#..... + ....#.......................#.........#.....#....#.............................................#.... + #...#......................##.....#....#.......#......#..........#.................#.....#.....#.... + .............#..#.....#..........#................#.......#..#.......#.........#.....#...#...#..#... + .....................#...........#.........#....#..........#................#.....#................. + #.#........#......#.......................#...............#..#.............##.......#..#...#........ + ....................#.................#.....#......#.............#..................#.............## + .#......#.........#.....#..............................#..............#..............##..........#.. + ..................#..##........#..................#...#.......#...#..#...#..........#...........##.. + ....#...#......#...#...#.......#.#........#..#...#.............#......#....##....#.#.....##........# + ....#...............#.....###............#...............................#.............#............ + .....#...#..........#..........#.....#.................#....................#...#.#....#...##....... + ...........#.#...#..............#...............#.......#.....................#...#................. + #...##.............................#..............#.....#.....#.....#.......#..........#....#...#... + .#..#......................#...#........##........................#.##...........#............#.#... + ...........#.......#..........#......#...............#.............#......##...#.#........#.#....... + ....#..............#....#.........................#......#.......................................... + .........#.#.............##..........#..........#...........#.......................#...#.#..#.#.#.. + ......#......#.........#.........#..........##..........#..................#..........#....#........ + ...................................#.......................................##.............#......... + .........................#...#.............#..#.....#......................##.......#........#...... + ....#...#.........................................#.......#.....................#.......#........#.. + ......#........................#......#............#..........................#...#................. + ...........#..#....#...............#..........................#.......................#............. + ......#..............#...#.#............................................#...............#.....#..... + .....#.....#........#.......#..........#.......#......#...#..#..#............#...##.....#...#....... + .#.......................................#.....#.##...#...........#..#....#......#......#...#....... + #.....#....#.....#.............................#....##......#..#.......#................#........... + ...................#................#.......................#..............................#.......# + ....................................#....#...................##...............#....#................ + ..................#.........#...#..#...................#.##.....#................................... + .#.......##.......#........................#........#............#.....#.....##..........#.......... + ......##.........#.#........#.....###...................#......#....#..#....#...#.........##........ + .......................#......#.........#.............##.......................#..#..............#.. + ...#.........................#........#........................#.#..........##.........#......##.#.. + ..#.............#...#....#........................ + .##...............#.#.........#.................#. + ...#....#...................................#..#.. + ............#.#.#....#............................ + .......#.................#......................#. + .............#........#.......#.......#....#...... + ....................#.......##..........#........# + .###....#..........#....#..............#........#. + ...#..#.#.......................#.#............... + .....#.#...#............#....#..........#...##.... + ......#....................#............#..#.#.... + ......#................#................#.#.#..... + ....#.#.......#.....#..#....#...................#. + ......#...............#.....................#....# + ......#......#.....................#.....####..... + ....#...........................#................. + ..#...#...............#.....#....#.....#.......... + .....#........#........#....#..........#.......... + .................#...#.....#...........##...#..... + .....................#..##..#...#................. + ...#.....##................#..#...#............... + ............#..............#....#................# + ...........##...#....#....#........#.............. + ........#.#........................#.............. + #.#.....#...........#.#..#....#..............#.#.. + .........##..#......#...#.................#....... + ....###...............#......................#.... + ..###......#.........#...........#........#....#.. + ........##...............#..#.....#............... + ......................#...................#...#..# + ..........##........#.......#.....#..#.......#.... + ##........................#............#.#..#..... + ..........##......#.....#.......#.........#....... + ...#...#.......#.#............................#... + .......................#...#..#.....#.......#....# + ....#.........................#..#................ + ....#.#......#..............#..............#..#... + ...............#....#....#......................#. + ..........#....#....##..........#..............#.. + .#...........#...........#.#...........#.......... + ..#..............#.......#........................ + ...##....#......#........#.#..............#....... + ...#.....##......#.............#.....#...##....... + .#......#...#...#...#..............#.............. + .##...............#............#......#....#...... + .......................................#..#.#..... + ............................#..........#.......... + ................#..........#...#......##......#... + .................#........#...#.....#.#..#........ + .#..#..#............#.......#..................... +.....................#......................................#..#...#.......................#........ +.........#................#.........#...........#.......##.............................#..#...#..... +.............###......................#......#........#.....#................###.#.................# +............................##...........#..#................................#..............#...#... +..#..............#.#..#.............#...........................#.....#............................. +.#...........#.#..##...............##.............................................#..#......##...... +..........#.#....................####..........#......#.....##.#........................#......#.... +......#..#......##.................#....#............#......#.....#......##.#..........#.......#.... +.......#...#...................#....#....#....................#.....................#..#.......#.... +....###...............#.................#.............#..#......#..#........#.....#................. +.#.#....#................#.................#.......................#......#.....#..#....#....#...... +.............#......#.............#.................#...........#..................#.....#..#....... +..#..#...........#.#......##.........#.............#........#..........#.........................#.. +..#...............#...........##........#.......#....##..#......#..#............#......##..###...... +.................##..............#...#................#.....#........##.........................#... +....#..............................................#...........#........#........#.........#..#..... +...#.........#.#.....#......#....................................##....##........#.................. +..#....#...................#...............#...#.....#...........##.............................#.#. +..........#....#..#.......................................#.....#.......#.....#........#............ +.#.....#..............##......#...........#.....................#..#.....................#.......##. +..............#.#..........................#....................#.....................#..#.......... +......#..................................#................................................#........# +#...##.........................#.....#.............#....#........#.......#..#..........#.........#.. +..#.##..##.......#.........#.........#..........#............#...............#.#.#.......#.......... +..............#........................##....#..........#...............................#........#.. +.........#............................#...............#..............#.........##.#.....#.###.#...#. +.........#.........##..........#........................#............#............#................. +#.#.................#..##..#.......##........................#..#....#....#...........#......#...... +............#.............................#....#..#....#..#.....##....#.................#........... +#.......#...#.#.............#....#...#.#..#..........#................#........#.#........#......... +#...##.............#...........................#..#...............#.#..................#...........# +#...#......................###.......#....##......#....##.........#.....#.........................## +............................................###......#.......#..#..............#.........##......... +##.......#...........#.......................#..#...................................#.............#. +#.#.....................##.....#...#...............#..#..#.#.......#...#....#....#.................. +.....#.........#...#.#......#..#....................#...........#..#.........#.....#.............#.. +...#..........#.......#.#.#..#...........#....#..#.....#...#......#....#....##.#........#........... +....#......#......#....#..#..........#..#....#....#...............#............#...#..........##.#.. +..........#...............#......##..................#...#....................#...#.....#...#....#.. +.......##.#....................#...#.....#......#........#.................#.......#...#.........#.. +...............#...................#.#......###...##.##...#..#..................#................... +..........#......#.................##.#..............................#..............#.....##........ +...#..#...#............###............#........#......#.....#..#......#...............#............. +.....#.......................##...#...................##.#..............#.....#........#............ +............##........#.....#...................#.............#...#..................#......#....... +#....#....#........#..#...#............#......#....#......####.....##...........#.....#............. +.#.........#........#....#..........#...#..........#......................#.............#...#.#..... +.........#.........#.#........#...................##....#.#.#......#....##.................#........ +.....#.........#..#.................#....#................#...............#...#..##.#.......#...#..# +............#..................#...#....................................#..........#.....#.##....... +....#.#...#...##....##............................ +..#..........##.....#............................. +.#.....#.......................................... +........#.....#...#...#........................... +.......#.......................................... +#.....#...#..#...........#........................ +.#...#..................##........................ +.........#....#....#.......................#...... +............................#.....#.............#. +....#...............##.......#.............#...... +................................#.#............... +....##...#....#.....#.......##......#.........#... +..#..........#.................#...............#.. +.......#............#......................###.... +............#.#....#..........#..........#........ +#.....#................#.......................... +..#...........#....#..#.#....#.............#...... +.........#............##....................##.... +...........#..........#.#.......#..#...........#.. +.....#.............#......#.......#.#.#........... +..#.....#........#.........#................#....# +..#.............#..........#.###..##...#.....##... +.......................#....#..........#....#..... +.#....###...#...#.....#........................... +#.........#.#...#....#....#..#.................... +.#...#...................................##....... +.....................................##.....#...#. +#....#.........#..#........................#..#..# +..............#....#.....##.......#............#.. +..........#.#......#....##....#...............#... +.........................###..#....#.....#........ +.................#......#....#...............#..#. +....#..#.....#...............#...#.......#........ +.................#...........#.................... +....#....#.........#..#........................#.. +....................................##...#......#. +...#.....#.............#..............#......#.... +....#..#........##...##...............#.#......... +....#.........................#..#..#...#....#..#. +..#...........#........#............#............. +............................#..............#...... +................#..........#....#........#.#...... +#..............................#.....#............ +#........#.........#..#..............#..........#. +..#..#.#..........#................#...........#.. +...#....#.......#...........#..........#.......#.# +....#..#.......#..#...........#................... +..#.......#......................#..#..#.......... +.......#...#....#.........#....#..........##...... +........#......................................... + +20L34L8L18L5L34R44L22L38L41R25R1L37R34R33R28L29R14L1L36L28R42R18R31L36R38R43L16R6L41R4L41R50R15R10R3L22R20L17R28L4L50R14R13L16L20R3R35L7R13R2L22L24R9R9R12L36R13R31L38L28L50L38L17R46R13L46L1L38L21L35R15L31L5R19L7R18R38R9L15L31R40L16L28R42L3R40R37L1R49L32L5R5L16L34R22R36L3L36R10L50R30L5L13L13L39L42R20R10R27L33L34L22L45L23R47L12L27R36L27L7R13L50R19R3L6R36R45R23L1R19L33R27R28L42L42R48L12L46L17L37L1L40L23R1R49R35L34L43R13R37R31L3L27R30L38R16L49R47L50R19L23R14L45R10L22L17R30L1L28R42L8R50R30R4R45R32L7L18R27R32L12L9R41R25R41R50L4L50L32R13R46L43R3R36R17R19R34R15L46R27L2L39R26L46L42R1L28R28R28R11R26R30L49L5L33L32R9R26R28L15L2R14L29R27R28L38L5R27L18R14L33R11L50R6L22L16R36R7R10R9L24R27L46L16R35L46R9L46R32R35L39L36R41R23L30L41L31L50L6L45R27R18L17R13R35L46R18R7R6L12L46L37R3L45L18R44L48L17L11L6R12L44R46L17L39R31L30L19L49R47L18R21L46R3R24L31L26L38R28R2L27R49R23R49R35L36R15L45R20R17R42R39R19R3R10R29L44L23L35L16L44R13R21L47L44R34R4L29R25L31R33L8L5R32R47L13L30R34R31R43L43R28R47L41L20L3R34L1R13R29L10R7L32L30R12L35L27L32L25L19L1L10L30R3L43R6R35R44R25L31L33R34L32R48R19R15R20R43L7R27R33L27L37R12L34R24L13R2L14R15L27L11R35R23R31R3R8R16R22R28L36L26R10R28L3R26R49L32R19L13R20L36R3R19R22R33L26R25R27L15R17L44L37L28L37R14R35R34R27L26L27L15L21R45L3R3R17L25L5L48L28R38L36L27L25R8R20R42R18L35R26L4L41L35L47L28L12R25R5L25L30R16R42R18R6R17R33R21L25L31R14L31R46L31L30R9R11R48L28R48L26R20L30R32L42L30R6L39L2L10L14L7R13L27R19R32R26L16R47L6L41L41R12R7R3L17R36L11R49L48R33R14L26L48L14R33R48L38R24L12L27R8L47R24R18R30L29R9R24R9L27L38R16L49R48L16L16L9R8L50R39L46R21L40L7L7L25R8R42L29R36R30L4L32L19R11R12R1L32R47L13L32R14R5L29L3R14R30L5R7L42L14L34R40L8R10L41L19R4R37R13R46R34R34L14L17L8R35L45L7L11R44R9L6L35L20L39L23R23L29L21R48R20R8L41R32R28L3L18L32R26L49L7L29L4R7L39L35R44R38L5R14R10R13L10R38L3L1R3R29L11L50R39L31L48L8L49R40R27R11R36R10R6L9L9R2L33L28L10L19R17L10R46R46R46L9L7L18R25R9L50R35R45L40L13L46L27L32L2L13R33L22R16L48L11L14L17R19L22R28R20R1R43R7R27R12R25L18L40L36R21L7R24L2L44L24L41L16L22L23L46L19L27L22L14R39L35R8L45R29L20R21R43L10R43R44L7L47L28R10R30L11R8R22R35R6L17L34L47L5L47L42R33L37L36L46L10R14R42R48L29L43R6L33L23R37R40R42L11R14L48R6L12L33L47R26R26R19R7L7L18L37L19L26R41L14L25L4R48R32R17L43L1R28L2L8L20L9R9R47L4R15L5R1L41L12L50L27R1R49L3L33R15L28L15R8L5R41L20L13R47R48L29R2R20L48R33R17L24L28L46R49R27L22R8L7R6R47R50L25R11L46R12L29R36L26L47L47R9L30R24L44L19R26R10R43R21L30R9R30R21L19R3L26L46L12R42L6R50R5R37R25R14L20L43R19R42L22R1L27L44R10R13L29L2R31L42R16L22R35L12R8L38L41L22L42L16R20R9L12L17L8L1L18L33R18L5L24L9R17R31R7L23L38L30R35L5L19R12R38R49L48L4R47R32R18L49L10R6R4R37R1L47L40L40R21L40L20R17R20R20L1R25R49R16R19L3L44L17R3R24R41R16R18R42R44R7L20R43L20R34L22R45L50R42L8R34R33L41R40R28L4L40L2R25L43L40L35L17L2R23R20R29L32R22R28L4R18L36R19R14R24R18L18R31R39L43L26L25R1R32R47L6R27R46R36R16L4R17L43L2R28R40L19L10L18L13R14L31L50L43L46R11L41L39R27L11R15R17L1R15R48L14L39L32L35L10R31L25L33L42R35R38R31L11R5R38R35R3R2R35R27R4R19L28R18R14L39R27L23R9R39R22R14R20R44L11L26L16R6R31L28R13L4R11R48R14L1R36L2R4L5L8R12R10L30R22L5R32L22R18R41R8R10R4L12L5L16L44L17L15L14R40L26L25R29L43L39R27L16R2R31R27L37L6L9R34R47R43L45L8R16L49L36L18R23R38L42R50L8R13L23L11R50L18L40R26L22L30L44L16R35R4L44L38L34R36L7R21L23R26R24L42L30L8L30L1L23L18R22R26L47L28L6R4R21L46R18L37R33L40L8L27L11R30R14R33L40R15L25L35R23R49L34R43R9R10L20R28L37L17R29L22L32R39L22L38L22L27L16L28L21R29L8R46R28R50L11L20R8R28R26R21R10R46L50L18L12L19L28R40R47R48R2R38R34R3R45L23L35R10R25R18L38L12L7R14L19R47L9R12R6R16L41R24L50L41R18R23L46R26L45L27L12R9R9R32R15R26L47R13R35R28R21L26L25R5L7L17L5L3R14R43R48L9L4R29L17R38R4L20L21R46L2R15L12R19L27R41R8L3R39R50L5R46R15L41R17L26L21R22L38L3L48L35L22R35R5R8L25R28L11L7R17L25R43L19L49R32L31L6R9L34L26L11R21L22R31L3R14L2R10L43L14L1L41R33R43R32R45R28L10L6L1L3L3L7L18L3L16R6L1L13R30R43L28R34L44L34L30L47L19L2R25R4R40R42L49R1R16R31L20L27L34L1L35R47L33L18L31L12L21R36R36R45L21R13L9L43R27R10R11R6L24R20R17R28L24L6R23L34R3R42R48L50L46L17R25R11L45R8L12R5L33R1L33R48R43R33R20L39R33L32L14L35R27L26L12L25L19R10L44L24L13L12R24R43R6L43L46R24R25L9L37R11L28L18L33L10L16R11R3R5R19R48L42L36R47R32L36L6L32L19L21R49R3L38R33R19L27R15L10R11L32L4L23R38L11L21R16L47R21L42L12L25L23L42L41L4L8R13R20L47L47R25R1R17L33R48L17R26L17R49L10L41L43R9L29L3R42L35R26L12L17L45L42R10R31R22L46L35R35R48R5R29L9L38R44L28R44R39R19L38L49R34R12R38R45R17R18L20R26L28L47L5L24R11R21R43R34L20R39L41L11L20R10L23R21R37L4R40L42R36L32L48L35R35R29L9L10L3R39L49R17L17R42R2R9R11L17L32R20R3L16L30L49L28L22L7L4R31L31L8L48L49R4L30R7L12R38L29L12R46R14L13L32R39L11L49R48R20R6R25L9L46R20R6L24R14L37R29L18L43R28L30L7R12R19L16L27L3L21L40L24L9R42R22L31L34L5L9R37L49L1R42L16L17L37R16R15L48L22R46L46L43L25R2R13R17L31R24L42L8R20L15L13L35R12L11L10L42R4R32R27L48R48L16L15R31L2L26R20R31R34R11R43R4R16L45L44R20L16R16L12L6R43L31R9L49L31R44L47L9L13R29R11L8R28L47R23L5L19R49L21R9L3R39R44R13L2L37R12R5R28R48R46L12L45L8R28R33R16R26L25L10L10R17L33R40R26R20R44R38R41L35L16R45R31L18L35R3R6L5R22L18L29L1R5L14R17R7L15R6L44R29L7R30L17R15R4R7L15R33R21L41L18R32L19L9L49L2R40L38L44L43L47L1L24L13L11L11L31R43L42L13R17L31L26R13R27R18R31R21L43L38R13R41R1R5R14L28R39L45L16L16L8L25R13L50R7L29R26L23L11R8L23R41R41L19R39R16R45L17L8R4R43L49R18R41L16L10R29L50R14R16R11L36R18R45L49R31L30L8L35L4L2R12L42L31R13L49R43R35R44L41R25R9R1L4L22L42L39L45R14L17L20R17L40L21L29R9L46R7L18R1L49L24L12L29R41R11R28R25R4R33L29R16R31R5L33L48R1R32L47R1L40R6R40L15L18R11R4R48R31R28R15L33L17R13R12L11L23L42R40L38L45L38L18L20L16R27R31R25L45R34L21R33L6R26L19L36R2L13R49L37R4L38R27L3R1R14L2L9L13R25L39L15R1L2R33L19R3R32R18L29L37R15L21L41L10R34R42R25R10R17L15R29L37L39R35L44L14L2L30L19L38L17R44L34R36R22R1R5R50L23L16L23L43L14L10R10L29L10R36L12R32L21R2R4R31R20L21L44R19R12L38L20R14R15R5 diff --git a/2022/22/test b/2022/22/test @@ -0,0 +1,14 @@ + ...# + .#.. + #... + .... +...#.......# +........#... +..#....#.... +..........#. + ...#.... + .....#.. + .#...... + ......#. + +10R5L5R10L4R5L5