diff --git a/wasm/o-x-rust/Cargo.lock b/wasm/o-x-rust/Cargo.lock index ebd7e24..9ec4fc9 100644 --- a/wasm/o-x-rust/Cargo.lock +++ b/wasm/o-x-rust/Cargo.lock @@ -25,7 +25,7 @@ dependencies = [ [[package]] name = "o-x-rust" -version = "0.0.6" +version = "0.0.7" dependencies = [ "wasm-bindgen", ] diff --git a/wasm/o-x-rust/Cargo.toml b/wasm/o-x-rust/Cargo.toml index 92898db..d5fe771 100644 --- a/wasm/o-x-rust/Cargo.toml +++ b/wasm/o-x-rust/Cargo.toml @@ -4,7 +4,7 @@ description = "Noughts and crosses WASM algorithms" repository = "https://git.koval.net/cyclane/game-algorithms/src/branch/main/wasm/o-x-rust" license = "GNU GPLv3" readme = "README.md" -version = "0.0.6" +version = "0.0.7" edition = "2021" [lib] diff --git a/wasm/o-x-rust/src/lib.rs b/wasm/o-x-rust/src/lib.rs index b3ff053..192d1ec 100644 --- a/wasm/o-x-rust/src/lib.rs +++ b/wasm/o-x-rust/src/lib.rs @@ -40,15 +40,15 @@ pub fn get_score(me: u8, other: u8, first: bool, board: &[u8]) -> f64 { score as f64 / outcomes as f64 } -// outcomes*2, winning outcomes (win = 2, draw = 1, loose = 0) +// outcomes, winning outcomes pub fn sub_get_score(me: u8, other: u8, first: bool, board: &[u8]) -> (i32, i32) { let winner = find_winner(board); if winner != 0 { - return if winner == me { (2, 2) } else { (2, 0) }; + return if winner == me { (1, 1) } else { (1, 0) }; } let empty = count_empty(board); if empty == 0 { - return (2, 1); + return (1, 0); } let mut score = 0; let mut outcomes = 0;