refact: BotStrategy dyn trait

This commit is contained in:
Henri Bourcereau 2024-11-04 17:37:36 +01:00
parent 4ee2b02a41
commit 5762187b04
6 changed files with 43 additions and 69 deletions

View file

@ -310,7 +310,7 @@ impl Board {
/// Check if a field is blocked for a player
pub fn blocked(&self, color: &Color, field: Field) -> Result<bool, Error> {
// the square is blocked on the opponent rest corner
let opp_corner_field = if color == &Color::White { 13 } else { 12 };
// let opp_corner_field = if color == &Color::White { 13 } else { 12 };
self.passage_blocked(color, field)
// .map(|blocked| blocked || opp_corner_field == field)
}

View file

@ -1,4 +1,3 @@
use crate::Error;
use rand::distributions::{Distribution, Uniform};
use rand::{rngs::StdRng, SeedableRng};
use serde::{Deserialize, Serialize};
@ -76,12 +75,6 @@ impl Dice {
// }
}
/// Trait to roll the dices
pub trait Roll {
/// Roll the dices
fn roll(&mut self) -> &mut Self;
}
#[cfg(test)]
mod tests {
use super::*;