Fixed predict
This commit is contained in:
parent
e160e60867
commit
8959858a03
|
@ -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",
|
||||||
]
|
]
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue