[WIP] Added a comment with ideas on how I could optimize day 14

This commit is contained in:
2022-12-16 12:30:01 +01:00
parent e6331778f2
commit 56cc1a53f3

View File

@@ -73,6 +73,13 @@ impl Day14 {
}
fn simulate_sand(&self, grid: &mut Grid<Cell>) -> SimulationResult {
// TODO test optimization ideas:
// 1. Store a stack of the path the sand took. When executing the next one, go up the stack and use the position
// that is found as the starting point for the current grain of sand
// 2. Just store the previous position of the sand before it came to rest, and start the siulation from there.
// 3. Use an quadtree for a represenation of the sand
let grid_height = grid.height();
let mut sand_coord = STARTING_COORD.clone();
loop {