Sfoglia il codice sorgente

Notes on extra checks.

There's more then just 9x9 that ksudoku can generate,
so check for the other puzzles.
Steve Thielemann 4 mesi fa
parent
commit
7c91620e32
1 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 10 0
      sudoku/src/ksudoku.rs

+ 10 - 0
sudoku/src/ksudoku.rs

@@ -4,6 +4,7 @@ use std::io::BufReader;
 use xml::reader::{EventReader, XmlEvent};
 use xml::writer::XmlEvent as WrXmlEvent;
 use xml::EmitterConfig;
+use std::collections::HashMap;
 
 use std::error::Error;
 
@@ -24,6 +25,15 @@ pub fn load_ksudoku(filename: std::path::PathBuf) -> Result<String, Box<dyn Erro
                     // <graph specific-type="Plain" type="sudoku" order="9"/>
                     // Verify these are correct / not some other puzzle type!
 
+                    // This might be overkill here, I just need to verify Plain/sudoku/9...
+                    
+                    let mut attrs: HashMap<String, String> = HashMap::new();
+                    for a in attributes {
+                        attrs.insert(a.name.to_string(), a.value);
+                    }
+                    // {"specific-type": "Plain", "type": "sudoku", "order": "9"}
+
+                    println!("{:?}", attrs);
                 }
             }
             Ok(XmlEvent::Characters(text)) => {