switch coordinates to global 'Coord' type
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
logic::r#move::Move,
|
||||
repr::{Board, Piece, Winner},
|
||||
repr::{Board, Coord, Piece, Winner},
|
||||
};
|
||||
use indicatif::{ProgressIterator, ProgressStyle};
|
||||
use std::{collections::HashMap, hash::BuildHasherDefault};
|
||||
@@ -216,7 +216,7 @@ impl FutureMoves {
|
||||
}
|
||||
|
||||
/// Return the best move which is a child of `self.current_root`
|
||||
pub fn best_move(&self) -> Option<(usize, usize)> {
|
||||
pub fn best_move(&self) -> Option<(Coord, Coord)> {
|
||||
self.current_root
|
||||
.and_then(|x| {
|
||||
self.arena[x]
|
||||
@@ -267,7 +267,7 @@ impl FutureMoves {
|
||||
/// Update the root based on the coordinate of the move
|
||||
/// Returns a boolean, `true` if the operation was successful, false if not
|
||||
#[must_use = "You must check if the root was properly set"]
|
||||
pub fn update_root_coord(&mut self, i: usize, j: usize) -> bool {
|
||||
pub fn update_root_coord(&mut self, i: Coord, j: Coord) -> bool {
|
||||
// check to make sure current_root is some so we dont
|
||||
// have to do that in the iterator
|
||||
if self.current_root.is_none() {
|
||||
@@ -493,7 +493,7 @@ mod tests {
|
||||
|
||||
// dummy (2)
|
||||
futm.arena.push(Move::new(
|
||||
Some((1234, 1234)),
|
||||
Some((123, 123)),
|
||||
Board::new(),
|
||||
Piece::White,
|
||||
Piece::Black,
|
||||
@@ -517,7 +517,7 @@ mod tests {
|
||||
|
||||
assert_ne!(
|
||||
futm.arena[2].coord,
|
||||
Some((1234, 1234)),
|
||||
Some((123, 123)),
|
||||
"dummy value still exists"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user