feat(web): solver input
This commit is contained in:
+14
-9
@@ -21,11 +21,6 @@ pub enum Color {
|
||||
GREEN,
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
pub fn alert(msg: &str);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[wasm_bindgen]
|
||||
impl Solver {
|
||||
@@ -50,14 +45,24 @@ impl Solver {
|
||||
.collect(),
|
||||
)?;
|
||||
|
||||
alert(&format!("{:?}", pat));
|
||||
|
||||
self.0.apply_guess(pat)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn stats(&self) -> String {
|
||||
self.0.tabular_format()
|
||||
pub fn guess_infos(&self) -> Vec<f64> {
|
||||
self.0
|
||||
.guesses()
|
||||
.iter()
|
||||
.map(|g| g.information_gained)
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn solution_space(&self) -> u64 {
|
||||
self.0.stats().0
|
||||
}
|
||||
|
||||
pub fn solution_space_uncertainty(&self) -> f64 {
|
||||
self.0.stats().1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user