From e3d4b31f88726e1941c2b3a60854ef64ace6187f Mon Sep 17 00:00:00 2001 From: Acvaxoort Date: Wed, 13 Dec 2023 22:36:13 +0100 Subject: [PATCH] fixed explanatory comments --- day12/src/main_dp.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/day12/src/main_dp.rs b/day12/src/main_dp.rs index e36a135..c87581c 100644 --- a/day12/src/main_dp.rs +++ b/day12/src/main_dp.rs @@ -5,12 +5,10 @@ use std::iter; const PRINT_VALUES: bool = false; const PRINT_VISUALISATION: bool = false; -// Counts all options by advancing through the spring layout from left to right, splitting at -// possible uncertainities. Groups sequences of uncertain values and uses combinatorics. +// Creates a cache for count_options_with_cache and calls it fn count_options_dp(layout: &[u8], broken_sequences: &[u32], sum_broken: u32) -> u64 { // Indexed with [a][b], storing results for computation, last a elements of layout - // and last b elements of broken_sequences - // u64::MAX marks values that will never be used and don't need to be computed + // and last b elements of broken_sequences, u64::MAX are values that aren't computed yet let mut cache: Vec> = vec![vec![u64::MAX; broken_sequences.len() + 1]; layout.len() + 1]; // For empty layout and empty broken sequences there's one option cache[0][0] = 1;