35 lines
592 B
Rust
35 lines
592 B
Rust
|
use crate::data::GameRules;
|
||
|
use actix::Addr;
|
||
|
use uuid::Uuid;
|
||
|
|
||
|
use crate::game::{Game, Player};
|
||
|
|
||
|
#[derive(Clone)]
|
||
|
pub struct RandomBot {
|
||
|
game: Addr<Game>,
|
||
|
uuid: Uuid,
|
||
|
}
|
||
|
|
||
|
impl RandomBot {
|
||
|
pub fn new(game: Addr<Game>) -> Self {
|
||
|
Self {
|
||
|
game,
|
||
|
uuid: Uuid::new_v4(),
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl Player for RandomBot {
|
||
|
fn get_name(&self) -> &str {
|
||
|
"Random Bot"
|
||
|
}
|
||
|
|
||
|
fn get_uid(&self) -> Uuid {
|
||
|
self.uuid
|
||
|
}
|
||
|
|
||
|
fn query_boats_layout(&self, rules: &GameRules) {
|
||
|
log::info!("Player requested boats configuration!");
|
||
|
}
|
||
|
}
|