refact: BotStrategy dyn trait
This commit is contained in:
parent
4ee2b02a41
commit
5762187b04
6 changed files with 43 additions and 69 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue