Jelajahi Sumber

Notes on changes for 4x4 and 5x5.

Steve Thielemann 4 bulan lalu
induk
melakukan
6195a619d8
1 mengubah file dengan 5 tambahan dan 1 penghapusan
  1. 5 1
      sudoku/src/sudoku.rs

+ 5 - 1
sudoku/src/sudoku.rs

@@ -20,6 +20,8 @@ use rand_chacha::rand_core::SeedableRng;
 use rand_chacha::ChaCha20Rng;
 use rand::distributions::{Distribution, Uniform};
 
+// If I wanted to do 4x4 or 5x5, I would need more bits. (u32).
+
 #[derive(Debug, Copy, Clone, PartialEq)]
 pub struct Bits(u16);
 
@@ -232,7 +234,9 @@ let arr: [Vec<u32>; 10] = [(); 10].map(|_| Vec::with_capacity(100));
 
 impl Sudoku {
     pub fn new() -> Self {
-        // let b : HashSet<u8> = HashSet::from_iter(1..=9);
+        // 10 = WIDTH + 1
+        // This would need to be changed in order to handle 4x4 or 5x5.
+        // NOTE: We ignore bit 0, we use bits 1-9 (for 3x3).
         let mut initial: Bits = Bits(set_bits(10));
         initial.set(0, false);