allow dead code

This commit is contained in:
2025-02-18 15:06:51 -05:00
parent 0d0b5786a2
commit 22bc4876e5
3 changed files with 12 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ use rand::prelude::*;
use std::io;
use std::io::prelude::*;
#[allow(dead_code)]
pub trait Agent {
/// Returns the move of an [`Agent`]
fn next_move(&mut self, board: &Board) -> Option<(usize, usize)>;
@@ -17,6 +18,14 @@ pub struct ManualAgent {
color: Piece,
}
impl ManualAgent {
#[allow(dead_code)]
pub const fn new(color: Piece) -> Self {
Self { color }
}
}
#[allow(dead_code)]
impl Agent for ManualAgent {
fn next_move(&mut self, board: &Board) -> Option<(usize, usize)> {
let stdin = io::stdin();
@@ -57,18 +66,12 @@ impl Agent for ManualAgent {
}
}
impl ManualAgent {
#[allow(dead_code)]
pub const fn new(color: Piece) -> Self {
Self { color }
}
}
/// An [`Agent`] that just makes a random move that is legal
pub struct RandomAgent {
color: Piece,
}
#[allow(dead_code)]
impl Agent for RandomAgent {
fn next_move(&mut self, board: &Board) -> Option<(usize, usize)> {
board.possible_moves(self.color).choose(&mut rand::rng())