fixed explanatory comments
This commit is contained in:
parent
672e465976
commit
e3d4b31f88
@ -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<u64>> = 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;
|
||||
|
Loading…
Reference in New Issue
Block a user