In Part One of the puzzle, the objective was to determine which bricks in a 3D stack could be safely disintegrated without causing any other bricks to fall. The challenge involved simulating the falling and settling of bricks and then analyzing the support structure of each brick.
- Parsing Input: Read and parse the input file to create a list of Brick objects, each representing a brick with its coordinates in 3D space.
- Applying Gravity: Simulate gravity to settle each brick into its final position. The logic checks if each brick can fall further down and stops when it either hits the ground or another brick.
- Determining Safe Disintegration: Analyze each brick to see if removing it would cause any other bricks to fall. This involves checking the support structure of each brick.
Part Two required determining the best brick to disintegrate, causing a chain reaction that would result in the most bricks falling. For each brick, the task was to calculate how many other bricks would fall if that brick were removed.
- Cascade Effect Analysis: For each brick, analyze the cascading effect of its removal. Determine how many other bricks would fall as a result.
- Count Affected Bricks: Sum the total number of bricks that would fall for each brick if it were removed.
This one gave me a lot of trouble and I fought with it a lot longer than I would have preferred.
Ultimately, after looking at some other people's solutions, and fighting with it, I got my solutions but I would like to revisit this one at some point as I was having a lot of trouble with this 3D space