adventofcode

git clone https://git.ce9e.org/adventofcode.git

commit
5b610ea9470197e4aefa6c18b9984f143f9a2e53
parent
e732ab1f2a2a31cad6a82f9a7e99cd2ceb7e76e1
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2022-12-17 10:57
2022-12-17 part1

Diffstat

A 2022/17/input.txt 1 +
A 2022/17/solution.rs 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A 2022/17/test.txt 1 +

3 files changed, 151 insertions, 0 deletions


diff --git a/2022/17/input.txt b/2022/17/input.txt

@@ -0,0 +1 @@
   -1     1 >>>><>><<>>>><<<>><<<<>><<<>>>><<<>>><<<<>><<>>>><<>>>><<<<>>>><><<<<>>><<>>>><<>>>><<><<<<>>>><<>>>><><<<>>>><<>><<<>><<<<>>>><<<<><>>>><<<><>>><<<<>>>><<>><<>><>><<<><<<<>>>><<<><><<>>><<>>><>>><>><>>>><<<<>>><>><<><>><<<>>>><<<<><><<>><<<>>><><<<<>>>><<<>><<<>>><<<>>><<<><<<>>>><<<<>>><<<<>><<><<<>>>><<<>>>><<<<>><><>><<>><<><<>>><>>><>>><<<><<<<>><<<><<<>><<>><><<<>><<<<><<<>>><<>>><>>><<<><>>>><<>>>><<>>><<<>>><<<<>><><<<>><>>>><<><><<>>>><<<<>>><<><<><<><<<>>>><<<>><<<><<>><>><><<<<>><<<>><<>>>><><<<<><<<<>>><<>>>><<<<><<<>>><<>>>><<>><<<>>><<>>><<>><<<>><<<>>><<>>><<>>>><><<>><<<>><<<><><<<>>>><<<>>>><<<>><<<<><<>>><<<>>>><<>>><>>>><<<>>>><<><>><<<>><<<<>>>><>>><<<><<>>><<<>>>><<<<>>>><<>>>><<><<><<<<><><<<>>><<>>><<<<>><<>>><>>>><<<<>><<>><<<<>>><<>>>><<<<>>>><<<<>><<<><<<<>><<<<>><<>><<>><<<<>>><<<>>><<<<>><>><<<><<>>>><<<<>>>><<<<>>><<<<>><<>>>><><><>>><<>>><<<>>>><>><<<<><<<<><><<>>><<<>>>><<<<>>><>><<<<>>>><>><<<>>><>>>><<<>>>><<>>><<<><<>>><<><<<<>>><<<<>>>><<>><>>><<>>><>>><<<>>><<<<>>><<<><>>>><<<<>><>>><<<>><<<>>><><<<><<><>><<<<>>>><<<>>>><<<><<<>><<<<>>>><<<>>>><<>><<<>><<<>>><<><<<<>>><<<<>><>>>><<>>>><<<>><>>>><<<>>><<>>><><>>>><<<>>>><>>>><<<>>><<<>>>><<>>>><<><<<>><<><>>>><<>>><<>>><>>><<<>>><<><<<><<>><<>>><<<<><<<><<<<>>><<<<><>><<>><<<>>><>><<><><<<<>>>><<>>>><<<<>><<<<>><>>><<<><<<<>><<<<>>><<<><<<>>>><>>><>>>><<<<>><<<<><><>>>><<<>>><<<><<<<><>><<<>>>><<<>>><<<<>>><<<<>><<<>><<<>><<<<>>><>>>><<<><<<>>><>><<>>>><<<>>><>>><<<<>>><<<>>>><>>><<><<>>><<>>>><<<><<<>><<>><<>>>><<<>><>>>><<<>>>><<>><>><>>>><<<>>><<>>><>>><<<>>>><<<>><>>><<<>>>><<<<>>>><<<><<><<>><<<>>>><<<<>>><>>><<>>><<<>><<>>><>>>><<<<>><<<<>>>><<>>>><><<<<>><>><<><><>><<<>><<<<>>><<<>>><<<<><<<<>>>><<<<>>>><<<<>>>><>><<>>>><<<<>><>>><<<<><<>>>><<<<>>><><<<<>>>><><<>>><<<<>>>><<<>><<><<><<>>><><>>><<<<><<<>>><<<<><<<<>>>><<>><<>>>><<<<><<<>>>><>><<<<>>><>><<<><>>><<<><>>><<><<>>><<<<><<<<><<>>>><>>><>>><>><>>>><<<<>>><<<<>>><<>>>><<<>>><<<<>>>><><>>><<<<>><<<><<<>>>><<<<>>><<<<>>><<<>>><<<<>><>><<>><<>>><<<>><>>><<>><<<<>>>><<>><<<>><<>><<<>>><<<>>>><<<>>><<<>>>><<>><<><>>><<<>>>><<<<>>>><<<>>>><>>>><<<>>><<<<>>>><<<>>><>>><>>><><>>>><<<>>>><><>>><<><>><<<<>>><<<<><<<<>>>><<<<>>><>><<<>>><<<>><<<<>>><<<<><<>><<><<><<<<>>>><<>><>><>>><>><<<>>>><<<>>>><<>><<><<<<>>><<><<<>><<<>>><<><<<<>>><<>><>><>>>><<><<<>><<<><<<<>><>><<<><>><<<>><<<>>>><<<<>>><<<<>>><<<><<>>>><<<>><<<<>><<<>>><<<<>>><<<<>><<>><<<>>>><<><<<>><<>>><<<<>>>><<<>><<<<>>>><<>>><<<<><<<>>><<<>>>><>>><<<<><<<>><<<><<<>><><<>>>><>>>><<<<>>>><><<<<><<>>>><><<<><<<>>><<>>>><<<<><><<<<>>><<<<>>><<>>><<>>><<>>><<>>><<<<>><>>><<>><<<>>><><>><<<>>><><>><<>><<<>>>><<<<>>>><>><<<<>>><><<<<>><<>>>><>><<>>>><>>><<<<>><<<<>>><>>>><<<>><>>><<<<>><<<<>><<>>><>>>><<<>>><<<<>>><<<>><<>>><<<>><<<<>>><<>>><>>>><<<>>>><<<>>><<<<><<>><<<<>>>><><<<<>>><><<>>><<<<><<>>>><<<<>>><<<<>>><<<<>><<<<>><<>><<<<>>>><<<>><<<><<<>>>><<>><<>>><<<<><<<<>>><<<><<<<>>>><<>><<>><<<>>><<<<>><<<<>><<<>>><>><<<><<<>><>>>><<<>><<<<>>><<>><<<>><>><>><<<>>><<<>>><<<><>><><>>>><<<>>><>>><<>>>><<<>>>><<><<><>>><<<>>>><<<>><<<>>>><>>>><<<><<>><><>><<<>>>><<<<><<<>>>><<>>>><<<<>>>><<>><>>><<<<>><<<<><>>>><<<>><<>>>><<<<><<<>>><<<>>><<<>>>><<<<>><>><>>><<>>><>>><<<<>><<<<><>>><<<>>><<<><<>><>><>>><<<>>><<<<>>>><<<<>>>><<>><<<>>>><>>>><<<>><>>>><<<<>><<<<>>><>><<<<>><<><<<>>>><<<>>><>><<>>>><>>>><<><><<>>><>><<<<>>><<<<><>>><<<>>>><<>>><<<><<<<>>><<<<>>><><<>>><<>><><<>>><>>><><<<>>><>>><<<<>>><<<>><<<><<<<><<>>>><<<<>>><<<>>>><>>><<>><>>><<<>>><><<<>>>><<<>>>><<<>>><<>>><<<>>>><<<>>><<>><><>>><<>>><<<<>>><<<><<<>>><<<<>><<<>>><<><<><>>>><<>><>>><<>>>><<<<>><<<><<<>>>><>>>><>><<<<>>>><<>>>><<<<>>>><<<>>>><>>>><>>><<<>>>><<<>>>><<>>>><<<<>>>><<>>>><<<><<<>>><<<>><>><<<>><<>><>>><<<>>>><<<>>>><<><<<>>>><<<><><<<<>><>>><<><<<<><<>><<<<>>>><<>><<<>>>><<><>><>>><<<>><>><<<<><>>><>><>><<<<>><>>>><<>>>><<>>><>>><<<<>><>>>><<<<>>>><<>>>><<>><<<<>><>>>><>><>><>>>><><<>><<<>>><<<>>>><<<><<<><<<<>><<<<>>>><<<>><<<>>><<<>>><>>>><>>><<<<>>><<<<>>><<<<>>><<<>><<<>><<<<>>>><<<>>>><<<>>>><<<>>><<>>><<<<>>>><<><<<>>><<><>><><<>>>><<>>><<>>><><<<>><<><<<>>>><<>><<<<>>><>>>><>><<><<<<>>>><>><<>><<><<<>>><<>>><<<<><>><<<>><><<<<><<>><<<<>>><<><<<>>>><<<<><>><<<><<<<>><<<<>>>><>>><<<<>>>><<>>><<<>>>><<<<>><<<>>>><<<>>>><<<<>>><<<<><<<><<>><<<<>>>><<<<>>>><<>>><<<>>>><<<>>>><<>>><<>>><<>>><<>>>><<>>><<>>><<><<<<>>>><>>>><<<><<>>><<>><<<<>><>>>><><<>>>><<<<>>><<>><<<>><<<>>>><<><><<>><<<<><>><<<<>>><><<>>><>><<<>>><<<<><>><>><<>>>><><<<>>>><<<<><<<>><<>>><<>><<<<>><<>>><>>>><<<<>><>>><>>><<>>>><<<>>>><<>><<>>>><>>>><<<<>>>><>>><<<<>>>><<<>>><<><<<>><<<>><<><><<<>>>><<<<>><<<><<<<>>><<<<><<<><<>><<>><<>>><>>>><<<<>><<<>>><>>>><<>><<<<>><>><>>><<<<><<<><<<<><<<<>>>><<<<>>>><>>>><<<>><<>>><><><>><<<>>><<>><<<<>>><<<>><<<>><<><<<<>><>>>><<<>>><<<><>>><>>><<>>><><<<<>><<<>><<>><<>>>><<<>>><><<<>>>><>>>><<<<>>>><<<<><<>>><<>>>><>><<<>>>><<>><<>><>>><>>><<>>><<<<>><>>>><>>><>><<<<><<>>><<<>>><<<>>>><<<>><<><<>><<>>>><<>>><>><<>>><>>>><<<<>>><<>><>><<<><>>>><<>>>><<<>>>><<>><<>>>><<>><<<>><<<<>>>><><<>>>><>><<>><<<>>><<<<>>>><<>>>><<><<>>>><<>><<>>>><>>><<<<>>>><>>><<<>>>><<<>><<<<>>>><<<>>>><>>><<<>>><>><>><<<>><<<><<>><<<>><>>>><>>><>>><<>>><<<>>>><<<<><<<>><<<<>><<<<>><>>>><<<>><<><><><<<<><<<<>>>><<>>><>>>><><<<<>>><>><>><>>><<<>>>><>>>><<><<<<>>><<<<>>><<>><><><><<<>>><<<<>><<>><<<>>>><>>><>>><<>>>><<<<>><<>>><<>><<<><>><<<<>><<>>><<<><<<>>>><<<><<><>>>><<>>>><<<<>><<>><<<><<<>>><>><<<>><<<<><<<>>>><>>>><<<>>>><><>>>><<>><<<<>>><<>><<>><>>><<<<>>><<>><<<>>><<<<><<<<>>><<<><<>>><<<<><<>>>><>><<<<>><><<<<>>><<<>>>><<<<>><><<>><<<>><>>>><<<>>>><<<>>><>><<><<<>><>><<>>><><<<<>>>><<<<>>>><<>>>><>>><<>>><<<><>>><<>>>><<<<>>>><<<>>>><>><<<<>>><<>><<<<>><<<<>><<><<<><>>>><<><<<>>>><>><<>>><>>><<>>><<<>>>><<<<>>>><<>><<<<><<<<><><<<>>><<<<>><<>>><<<>>><<<<>>><<<>><<><<<<>><<><<<>><<<<>><<<<>>>><>>><<<<>><<>><>>>><<>>>><<<<>>>><<<>>>><<<<><<<<>><>><>><<<<>><>><<<<><<<>>>><<<<><<>>>><>><<<<>>><<<>>><><>>><<<>><>><<>><>>>><>><<<>>><<<>><<<<>>><<>>>><<<<><<<>>>><<<<><<>><><<<>><>><<<<>>>><<<>>>><<<>>>><><<<<><<<<>><<<><<>><<>>><<<>>><>>>><<<>>>><<<>><><<<<><<<><><>>>><<<>><<<>>>><<<>>><<<>><<><<><>><<><<<<>>><<<<><><><<>>>><>><<<<>>>><<<<>>><<><<>><<>>><>>>><<<>><<<<><<<><<<<>><<<>>><<>>><<<<>><>>>><<<<>><>><><<<<>>><<<>>><<>>>><<<<>>><<<><<>><<<<><<<><<<<>><<><<><<>>><<<>>>><><<<>>>><<<<>>>><<<>><<<<>><<<<>>><>><<<<>>><>>><<<>><>>><<>>>><>>>><<>><>>>><>><>>><<<>>><>>><<>><<<<>>>><<<<>>><<>>>><<<<>>>><<>>><<>>>><<<>>><<<>>><>>><<<>>><<<>><><<<><<<<>><<>>><<>>><>>><<>><<>>>><<>>><<<>>>><<>>><<<<>><<>>>><>>><<<>>>><<>><>><>>>><<>>><>><><<<<>><<>>><<<<><>>>><<<>><><>>>><<<<>>>><<<>>>><<<>>>><>>><<<><><<<<><>>>><<>>>><<<<>>>><<<<><<<<>><<<<>>>><<<>>>><<><<>><<<>>>><<><<<<>><>>>><<>>>><>>><<<<>>>><<>>>><<<><>>>><<<<>>>><<<<>>><<<<>><><<>><<<><<><<<>><<>><>>>><<><>>><<<>><<<>>><<><<><<<<><>><<><<<>><<<<>><>>><>>>><<<>>>><>>>><<<>><>>>><><>>><<<<>>><<<<>>>><<><><<<><<<>>>><<<>>><<<>><<>>>><<><<<>><<<>><<>>>><<>><<<>>><<<<>>><<<<>><<><>>>><<<>>><<><>><<>><>>>><>>>><>>><<<<>><<><>>><<<<><<<>>>><><<>>>><<<>>>><<>>><<<<>>>><<<<>><>>>><>>>><<<<>>>><<<<>>><<<<><<>><<>>><<<>><<<<><<<>><<>><<<>><<<>><<<>>><<<>>><<>>>><>>>><<<<>>><<<<><<>>>><<>><<<<>><>><<>><<<><<<>>>><>><<<<><<<<>><>>><<>><<<>>>><<<>>>><<>>><<<>>><<><>>>><<<>>><><<<<>><<<><<<<><>>>><>>><<>><<><><><<><>><<<>>>><>>>><<>><<<>><<<<>>>><<>><<<><<>>>><<<<>>><<>>>><<<<>>>><<<>><<><><<<<>>><<>>>><<>>>><<<<>>>><<<<><<<>>>><<<<>><<<<>>><<<<><<<<><<><<<<>>><<>>>><>>><><<<<>><<>>><<<<>>>><<<>>><<<<><><<<<><<>>>><<>><<<<>><><<<<>>><<<<>>>><<>>>><<<<>><<<<><>>><<>>>><<<>>><<><>>><<<>>>><<<><<<<><<><<<>><<<<><<<>><><<<>><><>>><<<<>>><<<>>>><><<<>><<<<><<<<>><<<>><<>><><>>><<<>><<<<>>><<<><>>><<<><>><<>><<>><<<>>>><<<>>>><><<><<<<>>><<>>>><<>>><<>><<<>><<<<>>>><<<><<<><<><<<>>><><<<>>>><<><<>><<<>><>><<>>>><<<>>><<><<>><>><<<<>>>><<>>><<><<<<>>>><<><<>>><>>><<>>>><<<<>><<>><<<<>>>><<<>>><>><><<<>><<<<>><>><<<>><<>><<>><<<<>><<<<><><<<>>>><<<<><<<<>><<<<>>>><<>>><<<><<>>><<<<><<<<>>>><<<>>>><<<<><<<>>><<<>>>><<<<>><<<>>><<<<>>><<<>>>><>>>><<<>>><<<>>>><<<<>><<<<>>><<>>>><>>>><<>>>><<<>><<<<>>><<<>>><>>><<<>>>><<>>>><>>><<><>><<>>>><<><<<>>><<<<>>><<>>><<<>><<<>>><<>>><<<>>>><<<>>>><>>><<<<><>>>><<<>>><><<<><<<>><<<>>><<<<>><<>><<<<>>><<<>>><><<>>><<<>>>><>><<>>>><<<>><<<<>><><>>><>>><<>>>><<>>><><<<<>>>><<>>>><<<<>>>><<<<>><<<<>>>><<>>>><<>>><>><>>><<<>>>><<<><<>>><<<<><<<><<>>>><>><<<<>><<>>><><<<><<<><<<>>>><>><><<<<>>>><<<<>>><>>><<<>>>><>><<<>><<><<<<>><>>><>>>><<<<>><<>><>><<<>>>><><>>>><<>>>><>>><<<><<<>><<><<>>><<<<>><<>>><<>>><<<<>>><<<>><<<>><<>><<<<>>>><><<><<<<><<>><<<<><<>>><<>>><<><<<>>><<><<<<>>>><<<>>><<<<>>><<<>>><>>><<>><<<><<<>>>><>><<<<>><<<>>>><<<><<>><<<<>><>><<<<>><<<<>>><<<<>>><>><<<>>><>>><>>>><>>>><<<>>><<<><<<>><<>>>><<<>>><><<>>><>>><>>><<>>>><>>>><<<>><<<><>><<<<>>>><<>>><<<<>>><<<>><<<>>><<<>><>>>><<<<><<<<>>><>>><<<<>>>><<<>><<<<><<>>><<>>>><<<><<<><>>>><<>>><<<<><<<<><<<<><<<<>>><<<<>>><<>><<<><<<>>><<>><>>>><>>><<<<>><<>>><<>>><<<<><<<>>>><<><>>><<<<><<<><<<<>>>><>>>><<<<>>>><<>>>><<>>><<<>>>><<>>><<>><<<<>><<>>>><<><<<<>>>><<<<>>><<><>><<<>><>><><>>>><<<>>>><<<<>>>><<>><<>>><<<<><<<>>><<<>>>><>>>><<>>><<>>><<<>>>><<>>><>>>><<>>>><<<<>>><>><<<>>><<<<>>><>>>><>>>><<<<>>><>>><>><<>>><>><<<<>>><>>>><>>><<<><<><<<<><<<<>>>><<>>><<<<><<<>>>><<<<>>>><<>><<<>>>><<<<>><<>>>><<<>>><>><<<<>>>><<<<>>>><<<<>><><<<<>>><<<<>><<<<>>><<<>><<>><<>>>><<<<>>>><<><>>><<<>>>><<<<>>>><<<>>><>>>><<>>><><<<<>><<<><<>>><<<<><<>>><<<><<<><<<<>>>><<>><>>><<<<>>>><>><><<<<>>><<>>><<<>>><>>>><>>>><><>>><<<<>>><<<>>><<><<<>><<<>>><<<>>><<<<>><<<>>>><<<>>>><<<>><<<<><<<<>><><>>><<>>><<<<><<><<>><<<<>>><<<<>>><<<<>><<><<<>><><<>><<<>>>><<<><<<><<<<>>>><<<><<<<>><<<>>>><>>><<<<>>><<<<>>>><<>><><<<>>>><<>><<<<>>><<<>><<<<><<<>><>>><<<><<<<><<<>>><<<<>>><<<<><<>>><>><<<<>><<><<>>><<<<><<>>><<><<>>>><<<<><<<><>>><<>>>><<>>>><><<>><<<>>><>><<><<<<>>>><<>>>><<<>>>><>>><<<>><<<>>><><>><<>><>><<>><<<><<<<>>>><<<>>><<>><<<>>><<><>>><<>><<<>>><<<><<>>>><>><>>><><<<>>>><<<<><<<>><<<><<<><>>><<<>>><<>><>>>><>>><<

diff --git a/2022/17/solution.rs b/2022/17/solution.rs

@@ -0,0 +1,149 @@
   -1     1 use std::collections::HashSet;
   -1     2 
   -1     3 #[path = "../lib.rs"] mod lib;
   -1     4 
   -1     5 struct Shape {
   -1     6     blocks: HashSet<(i64, i64)>,
   -1     7     bottom: HashSet<(i64, i64)>,
   -1     8     left: HashSet<(i64, i64)>,
   -1     9     right: HashSet<(i64, i64)>,
   -1    10     width: i64,
   -1    11     height: i64,
   -1    12 }
   -1    13 
   -1    14 fn make_shape(blocks: Vec<(i64, i64)>) -> Shape {
   -1    15     return Shape {
   -1    16         blocks: blocks.iter().map(|(x, y)| (*x, *y)).collect(),
   -1    17         bottom: blocks.iter().filter(|(x, y)| !blocks.contains(&(*x, *y - 1))).map(|(x, y)| (*x, *y)).collect(),
   -1    18         left: blocks.iter().filter(|(x, y)| !blocks.contains(&(*x - 1, *y))).map(|(x, y)| (*x, *y)).collect(),
   -1    19         right: blocks.iter().filter(|(x, y)| !blocks.contains(&(*x + 1, *y))).map(|(x, y)| (*x, *y)).collect(),
   -1    20         width: blocks.iter().map(|(x, _)| *x).max().unwrap() + 1,
   -1    21         height: blocks.iter().map(|(_, y)| *y).max().unwrap() + 1,
   -1    22     };
   -1    23 }
   -1    24 
   -1    25 fn get_input() -> Vec<bool> {
   -1    26     let mut moves = vec![];
   -1    27     for line in lib::iter_input() {
   -1    28         for c in line.chars() {
   -1    29             match c {
   -1    30                 '<' => moves.push(false),
   -1    31                 '>' => moves.push(true),
   -1    32                 _ => unreachable!(),
   -1    33             }
   -1    34         }
   -1    35     }
   -1    36     return moves;
   -1    37 }
   -1    38 
   -1    39 fn render(covered: &HashSet<(i64, i64)>) {
   -1    40     // let width = covered.iter().map(|(x, _)| *x).max().unwrap() + 1;
   -1    41     let width = 7;
   -1    42     let height = covered.iter().map(|(_, y)| *y).max().unwrap() + 1;
   -1    43 
   -1    44     for y in (0..height + 3).rev() {
   -1    45         for x in 0..width {
   -1    46             if covered.contains(&(x, y)) {
   -1    47                 print!("#");
   -1    48             } else {
   -1    49                 print!(".");
   -1    50             }
   -1    51         }
   -1    52         print!("\n");
   -1    53     }
   -1    54     print!("\n");
   -1    55 }
   -1    56 
   -1    57 fn part1(moves: &Vec<bool>, shapes: &[Shape; 5], width: i64, n: usize) -> i64 {
   -1    58     let mut height = 0;
   -1    59     let mut move_i = 0;
   -1    60     let mut covered: HashSet<(i64, i64)> = HashSet::new();
   -1    61 
   -1    62     for i in 0..n {
   -1    63         let shape = &shapes[i % shapes.len()];
   -1    64         let mut x = 2;
   -1    65         let mut y = height + 3;
   -1    66 
   -1    67         // for _ in 0..3 {
   -1    68         //     if moves[move_i] {
   -1    69         //         if x + shape.width + 1 < width {
   -1    70         //             x += 1;
   -1    71         //         }
   -1    72         //     } else {
   -1    73         //         if x > 0 {
   -1    74         //             x -= 1;
   -1    75         //         }
   -1    76         //     }
   -1    77         //     move_i = (move_i + 1) % moves.len();
   -1    78         // }
   -1    79 
   -1    80         loop {
   -1    81             let move_right = moves[move_i];
   -1    82             if move_right {
   -1    83                 if x + shape.width < width && shape.right.iter().all(|(xs, ys)| !covered.contains(&((x + *xs + 1, y + *ys)))) {
   -1    84                     x += 1;
   -1    85                 }
   -1    86             } else {
   -1    87                 if x > 0 && shape.left.iter().all(|(xs, ys)| !covered.contains(&((x + *xs - 1, y + *ys)))) {
   -1    88                     x -= 1;
   -1    89                 }
   -1    90             }
   -1    91             move_i = (move_i + 1) % moves.len();
   -1    92 
   -1    93             if y > 0 && shape.bottom.iter().all(|(xs, ys)| !covered.contains(&((x + *xs, y + *ys - 1)))) {
   -1    94                 y -= 1;
   -1    95             } else {
   -1    96                 break;
   -1    97             }
   -1    98         }
   -1    99 
   -1   100         covered.extend(shape.blocks.iter().map(|(xs, ys)| (x + xs, y + ys)));
   -1   101         height = (y + shape.height).max(height);
   -1   102 
   -1   103         // render(&covered);
   -1   104     }
   -1   105     // render(&covered);
   -1   106 
   -1   107     return height;
   -1   108 }
   -1   109 
   -1   110 fn main() {
   -1   111     let moves = get_input();
   -1   112     let shapes = [
   -1   113         make_shape(vec![
   -1   114             (0, 0),
   -1   115             (1, 0),
   -1   116             (2, 0),
   -1   117             (3, 0),
   -1   118         ]),
   -1   119         make_shape(vec![
   -1   120             (1, 1),
   -1   121             (0, 1),
   -1   122             (2, 1),
   -1   123             (1, 0),
   -1   124             (1, 2),
   -1   125         ]),
   -1   126         make_shape(vec![
   -1   127             (0, 0),
   -1   128             (1, 0),
   -1   129             (2, 0),
   -1   130             (2, 1),
   -1   131             (2, 2),
   -1   132         ]),
   -1   133         make_shape(vec![
   -1   134             (0, 0),
   -1   135             (0, 1),
   -1   136             (0, 2),
   -1   137             (0, 3),
   -1   138         ]),
   -1   139         make_shape(vec![
   -1   140             (0, 0),
   -1   141             (1, 0),
   -1   142             (0, 1),
   -1   143             (1, 1),
   -1   144         ]),
   -1   145     ];
   -1   146 
   -1   147     println!("part1: {}", part1(&moves, &shapes, 7, 2022));
   -1   148     // println!("part2: {}", part2(&optimized, 26));
   -1   149 }

diff --git a/2022/17/test.txt b/2022/17/test.txt

@@ -0,0 +1 @@
   -1     1 >>><<><>><<<>><>>><<<>>><<<><<<>><>><<>>