Expand description
§Transparent Origami
There are 2 possible approaches to tracking the position of dots after each fold:
- A
HashSetthat will collapse duplicate entries - An array of sufficient dimensions to track every possible coordinate.
We will use both approaches for speed, the first in part one and the second in part two.
For part two we can determine the final size of the paper by taking the last x and y coordinates from the fold instructions. Because each fold cuts the remaining paper in half, the layout of points that map to the same condensed positions is periodic. It’s faster and more convenient to process each point completely using modular math to go straight to the condensed position without worrying about any intermediate folds.