Explorar el Código

Notes on extra checks.

There's more then just 9x9 that ksudoku can generate,
so check for the other puzzles.
Steve Thielemann hace 11 meses
padre
commit
7c91620e32
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  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)) => {