diff options
Diffstat (limited to 'src/solvers/intuitive.rs')
-rw-r--r-- | src/solvers/intuitive.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/solvers/intuitive.rs b/src/solvers/intuitive.rs index 16baa03..f4deb8c 100644 --- a/src/solvers/intuitive.rs +++ b/src/solvers/intuitive.rs @@ -106,11 +106,11 @@ impl<T: num::PrimInt> NormalSolver<T> { } let mut new_num = Vec::from(numbers); for i in numbers[index as usize] as usize..up { - self.permute(up, index + 1, &new_num); - new_num[index] += 1; for n in (index + 1)..numbers.len() { - new_num[n] = (i + 1 + n - index) as u32; + new_num[n] = (n * (self.permutations.len() / self.h as usize)) as u32; } + self.permute(up, index + 1, &new_num); + new_num[index] += 1; } } @@ -118,7 +118,7 @@ impl<T: num::PrimInt> NormalSolver<T> { let mut sums = vec![self.w; self.w as usize]; for (i, num) in nums.iter().enumerate() { let mut sum = 0; - for n in self.permutations[*num as usize][..self.h as usize].iter() { + for n in self.permutations[*num as usize][..=self.h as usize].iter() { sum += *n as usize; if sums[sum - 1] != self.w { return false; @@ -126,7 +126,10 @@ impl<T: num::PrimInt> NormalSolver<T> { sums[sum - 1] = i as u32; } } - GapHeights::from_heights(sums.iter().map(|x| *x as u32).collect()).output(self.w, self.h); + //println!("{:?}", sums); + GapHeights::from_heights(sums.iter().map(|x| *x as u32).collect()).output(self.n, self.h); + //.as_stone_wall(self.n) + //.output(); true } |