add comments

This commit is contained in:
2025-02-13 13:39:23 -05:00
parent 9a8b674720
commit 81c08f5407
3 changed files with 35 additions and 11 deletions

View File

@@ -4,11 +4,15 @@ use std::io;
use std::io::prelude::*;
pub trait Agent {
/// Returns the move of an [`Agent`]
fn next_move(&mut self, board: &Board) -> Option<(usize, usize)>;
/// Returns the name of the [`Agent`]
fn name(&self) -> &'static str;
/// Returns the color the [`Agent`] is playing
fn color(&self) -> Piece;
}
/// An [`Agent`] which a user controls
pub struct ManualAgent {
color: Piece,
}
@@ -60,6 +64,7 @@ impl ManualAgent {
}
}
/// An [`Agent`] that just makes a random move that is legal
pub struct RandomAgent {
color: Piece,
}