feat(web): solver input

This commit is contained in:
2026-08-20 19:04:10 +02:00
parent ae2cf56081
commit 27c308d632
4 changed files with 151 additions and 33 deletions
+14 -9
View File
@@ -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
}
}