This commit is contained in:
2025-01-28 16:12:33 -05:00
parent 6ed4208534
commit 78ce4d4973
4 changed files with 3 additions and 245 deletions

View File

@@ -68,7 +68,7 @@ impl Board {
}
pub fn what_if(&self, i: usize, j: usize, piece: Piece) -> Option<(Self, usize)> {
let mut self_copy = self.clone();
let mut self_copy = *self;
if self_copy.get(i, j).is_some() {
return None;
}
@@ -85,7 +85,7 @@ impl Board {
return Ok(());
}
}
Err(format!("move would not propegate"))
Err("move would not propegate".to_string())
}
/// Propegate piece captures originating from (i, j)

View File

@@ -1,14 +1,11 @@
use crate::{
agent::Agent,
board::{Board, BOARD_SIZE},
misc::offsets,
piece::Piece,
};
use rand::{rngs::ThreadRng, seq::IteratorRandom};
pub struct ComplexAgent {
color: Piece,
rng: ThreadRng,
}
impl Agent for ComplexAgent {
@@ -36,9 +33,6 @@ impl Agent for ComplexAgent {
impl ComplexAgent {
pub fn new(color: Piece) -> Self {
Self {
color,
rng: rand::rng(),
}
Self { color }
}
}