ai-othello 0.1.1

An Othello rules, evaluation, and alpha-beta search engine
Documentation
use crate::protocol::Engine;
use wasm_bindgen::prelude::*;

#[wasm_bindgen]
pub struct OthelloSession {
    inner: Engine,
}

#[wasm_bindgen]
impl OthelloSession {
    #[wasm_bindgen(constructor)]
    pub fn new() -> Self {
        Self {
            inner: Engine::new(),
        }
    }

    pub fn command(&mut self, line: &str) -> String {
        self.inner.command(line).join("\n")
    }

    pub fn snapshot(&self) -> String {
        self.inner.snapshot_json()
    }
}

impl Default for OthelloSession {
    fn default() -> Self {
        Self::new()
    }
}