Fixed predict
This commit is contained in:
		
							
								
								
									
										2
									
								
								wasm/o-x-rust/Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								wasm/o-x-rust/Cargo.lock
									
									
									
										generated
									
									
									
								
							@@ -25,7 +25,7 @@ dependencies = [
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "o-x-rust"
 | 
			
		||||
version = "0.0.4"
 | 
			
		||||
version = "0.0.5"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "wasm-bindgen",
 | 
			
		||||
]
 | 
			
		||||
 
 | 
			
		||||
@@ -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]
 | 
			
		||||
 
 | 
			
		||||
@@ -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.
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user