From 8959858a03f2471755288e529fbd4e9b4a83cc63 Mon Sep 17 00:00:00 2001 From: Gleb Koval Date: Mon, 8 Aug 2022 00:10:48 +0000 Subject: [PATCH] Fixed predict --- wasm/o-x-rust/Cargo.lock | 2 +- wasm/o-x-rust/Cargo.toml | 4 ++-- wasm/o-x-rust/README.md | 2 +- wasm/o-x-rust/src/lib.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wasm/o-x-rust/Cargo.lock b/wasm/o-x-rust/Cargo.lock index d3fcb2e..8d5c546 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.4" +version = "0.0.5" dependencies = [ "wasm-bindgen", ] diff --git a/wasm/o-x-rust/Cargo.toml b/wasm/o-x-rust/Cargo.toml index f5ed655..46fd215 100644 --- a/wasm/o-x-rust/Cargo.toml +++ b/wasm/o-x-rust/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "o-x-rust" -description = "Naughts and crosses WASM algorithms" +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.4" +version = "0.0.5" edition = "2021" [lib] diff --git a/wasm/o-x-rust/README.md b/wasm/o-x-rust/README.md index ace742f..394a6ba 100644 --- a/wasm/o-x-rust/README.md +++ b/wasm/o-x-rust/README.md @@ -1,3 +1,3 @@ # Os & Xs Rust -This crate contains implementation(s) for naughts & crosses algorithm(s) for use on the frontend as WASM. +This crate contains implementation(s) for noughts & crosses algorithm(s) for use on the frontend as WASM. diff --git a/wasm/o-x-rust/src/lib.rs b/wasm/o-x-rust/src/lib.rs index d6ff8bb..265cb2d 100644 --- a/wasm/o-x-rust/src/lib.rs +++ b/wasm/o-x-rust/src/lib.rs @@ -71,7 +71,7 @@ pub fn predict(me: u8, other: u8, first: bool, board: &[u8]) -> usize { let copy = &mut [0u8; 9]; copy.copy_from_slice(board); copy[i] = get_turn(me, other, first, empty); - let score = get_score(me, other, first, board); + let score = get_score(me, other, first, copy); if score > max_s { (max_p, max_s) = (i, score); }