remove QueueAgent
This commit is contained in:
29
src/agent.rs
29
src/agent.rs
@@ -1,5 +1,4 @@
|
||||
use crate::{board::Board, piece::Piece};
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub trait Agent {
|
||||
fn next_move(&mut self, board: &Board) -> Option<(usize, usize)>;
|
||||
@@ -24,31 +23,3 @@ impl Agent for ManualAgent {
|
||||
self.color
|
||||
}
|
||||
}
|
||||
|
||||
pub struct QueueAgent {
|
||||
moves: VecDeque<(usize, usize)>,
|
||||
color: Piece,
|
||||
}
|
||||
|
||||
impl QueueAgent {
|
||||
pub fn new(moves: impl IntoIterator<Item = (usize, usize)>, color: Piece) -> Self {
|
||||
Self {
|
||||
moves: moves.into_iter().collect(),
|
||||
color,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Agent for QueueAgent {
|
||||
fn next_move(&mut self, _: &Board) -> Option<(usize, usize)> {
|
||||
self.moves.pop_front()
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"Queue Agent"
|
||||
}
|
||||
|
||||
fn color(&self) -> Piece {
|
||||
self.color
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user