Skip to content

Commit

Permalink
remove dead code from day 22
Browse files Browse the repository at this point in the history
  • Loading branch information
kcaffrey committed Dec 22, 2023
1 parent 1d309cc commit 76bbf8c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
<!--- benchmarking table --->

---
Expand Down
3 changes: 0 additions & 3 deletions src/bin/22.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ struct Brick {
#[derive(Debug, Default, Clone)]
struct Tower {
bricks: Vec<Brick>,
brick_heights: Vec<u16>,
supports: Vec<FxHashSet<usize>>,
supported: Vec<FxHashSet<usize>>,
xy_heights: FxHashMap<Point2, (usize, u16)>,
Expand All @@ -82,14 +81,12 @@ impl Tower {
pub fn from_bricks(bricks: Vec<Brick>) -> 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 {
Expand Down

0 comments on commit 76bbf8c

Please sign in to comment.