ignore draws
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]] | [[package]] | ||||||
| name = "o-x-rust" | name = "o-x-rust" | ||||||
| version = "0.0.6" | version = "0.0.7" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "wasm-bindgen", |  "wasm-bindgen", | ||||||
| ] | ] | ||||||
|   | |||||||
| @@ -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" | 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.6" | version = "0.0.7" | ||||||
| edition = "2021" | edition = "2021" | ||||||
|  |  | ||||||
| [lib] | [lib] | ||||||
|   | |||||||
| @@ -40,15 +40,15 @@ pub fn get_score(me: u8, other: u8, first: bool, board: &[u8]) -> f64 { | |||||||
| 	score as f64 / outcomes as 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) { | pub fn sub_get_score(me: u8, other: u8, first: bool, board: &[u8]) -> (i32, i32) { | ||||||
| 	let winner = find_winner(board); | 	let winner = find_winner(board); | ||||||
| 	if winner != 0 { | 	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); | 	let empty = count_empty(board); | ||||||
| 	if empty == 0 { | 	if empty == 0 { | ||||||
| 		return (2, 1); | 		return (1, 0); | ||||||
| 	} | 	} | ||||||
| 	let mut score = 0; | 	let mut score = 0; | ||||||
| 	let mut outcomes = 0; | 	let mut outcomes = 0; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user