This commit is contained in:
2025-01-26 00:44:19 -05:00
parent 283158b00f
commit ad551391b2
4 changed files with 52 additions and 8 deletions

View File

@@ -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 }
}
}