[WIP] Added a comment with ideas on how I could optimize day 14
This commit is contained in:
@@ -73,6 +73,13 @@ impl Day14 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn simulate_sand(&self, grid: &mut Grid<Cell>) -> SimulationResult {
|
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 grid_height = grid.height();
|
||||||
let mut sand_coord = STARTING_COORD.clone();
|
let mut sand_coord = STARTING_COORD.clone();
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
Reference in New Issue
Block a user