From 76bbf8c5d8ab9866d014882fff26453c13a887f9 Mon Sep 17 00:00:00 2001 From: Kevin Caffrey Date: Fri, 22 Dec 2023 15:22:08 -0500 Subject: [PATCH] remove dead code from day 22 --- README.md | 4 ++-- src/bin/22.rs | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index af7dbbe..818f43d 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,9 @@ Solutions for [Advent of Code](https://adventofcode.com/) in [Rust](https://www. | [Day 19](./src/bin/19.rs) | `83.9µs` | `90.9µs` | | [Day 20](./src/bin/20.rs) | `323.9µs` | `1.2ms` | | [Day 21](./src/bin/21.rs) | `64.1µs` | `494.7µs` | -| [Day 22](./src/bin/22.rs) | `250.3µs` | `424.3µs` | +| [Day 22](./src/bin/22.rs) | `245.8µs` | `420.4µs` | -**Total: 17.01ms** +**Total: 17.00ms** --- diff --git a/src/bin/22.rs b/src/bin/22.rs index f4321ec..99b6c6d 100644 --- a/src/bin/22.rs +++ b/src/bin/22.rs @@ -72,7 +72,6 @@ struct Brick { #[derive(Debug, Default, Clone)] struct Tower { bricks: Vec, - brick_heights: Vec, supports: Vec>, supported: Vec>, xy_heights: FxHashMap, @@ -82,14 +81,12 @@ impl Tower { pub fn from_bricks(bricks: Vec) -> Self { let mut ret = Self::default(); ret.bricks = bricks; - ret.brick_heights = vec![0; ret.bricks.len()]; ret.supports = vec![Default::default(); ret.bricks.len()]; ret.supported = vec![Default::default(); ret.bricks.len()]; for i in 0..ret.bricks.len() { let brick = ret.bricks[i]; let (_, floor_height) = ret.get_max_height(brick); let brick_height = brick.ends[1].z - brick.ends[0].z + floor_height + 1; - ret.brick_heights[i] = floor_height + 1; for point in brick.xy_points() { let (loadbearing_index, loadbearing_height) = ret.get_height(point); if loadbearing_height == floor_height && loadbearing_height > 0 {