stuff
This commit is contained in:
42
src/agent.rs
42
src/agent.rs
@@ -1,15 +1,41 @@
|
||||
use crate::repr::Piece;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct Agent {
|
||||
use crate::repr::{Board, Piece};
|
||||
|
||||
pub trait Agent {
|
||||
fn next_move(&mut self, board: &Board) -> Option<(usize, usize)>;
|
||||
}
|
||||
|
||||
pub struct ManualAgent {}
|
||||
|
||||
impl Agent for ManualAgent {
|
||||
fn next_move(&mut self, board: &Board) -> Option<(usize, usize)> {
|
||||
todo!("user input not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
pub struct QueueAgent {
|
||||
moves: VecDeque<(usize, usize)>,
|
||||
}
|
||||
|
||||
impl Agent for QueueAgent {
|
||||
fn next_move(&mut self, board: &Board) -> Option<(usize, usize)> {
|
||||
self.moves.pop_front()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct AutoAgent {
|
||||
color: Piece,
|
||||
}
|
||||
|
||||
impl Agent {
|
||||
pub const fn new(color: Piece) -> Self {
|
||||
Self { color }
|
||||
}
|
||||
|
||||
pub fn next_move() -> (usize, usize) {
|
||||
impl Agent for AutoAgent {
|
||||
fn next_move(&mut self, board: &Board) -> Option<(usize, usize)> {
|
||||
todo!("next_move not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
impl AutoAgent {
|
||||
pub const fn new(color: Piece) -> Self {
|
||||
Self { color }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user