Fixed predict
ci/woodpecker/push/tools-wasm-pack-plugin Pipeline was successful Details
ci/woodpecker/push/wasm-o-x-rust Pipeline was successful Details

This commit is contained in:
Gleb Koval 2022-08-08 00:10:48 +00:00
parent e160e60867
commit 8959858a03
Signed by: cyclane
GPG Key ID: 15E168A8B332382C
4 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@ dependencies = [
[[package]] [[package]]
name = "o-x-rust" name = "o-x-rust"
version = "0.0.4" version = "0.0.5"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]

View File

@ -1,10 +1,10 @@
[package] [package]
name = "o-x-rust" 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" repository = "https://git.koval.net/cyclane/game-algorithms/src/branch/main/wasm/o-x-rust"
license = "GNU GPLv3" license = "GNU GPLv3"
readme = "README.md" readme = "README.md"
version = "0.0.4" version = "0.0.5"
edition = "2021" edition = "2021"
[lib] [lib]

View File

@ -1,3 +1,3 @@
# Os & Xs Rust # 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.

View File

@ -71,7 +71,7 @@ pub fn predict(me: u8, other: u8, first: bool, board: &[u8]) -> usize {
let copy = &mut [0u8; 9]; let copy = &mut [0u8; 9];
copy.copy_from_slice(board); copy.copy_from_slice(board);
copy[i] = get_turn(me, other, first, empty); 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 { if score > max_s {
(max_p, max_s) = (i, score); (max_p, max_s) = (i, score);
} }