use crate::{Action, Card, History, Score};
#[derive(Debug, Clone, Copy)]
pub struct Bot;
#[derive(Debug, Clone, PartialEq)]
pub struct OtherBot {
pub name: String,
pub coins: u8,
pub cards: u8,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Context {
pub name: String,
pub cards: Vec<Card>,
pub coins: u8,
pub playing_bots: Vec<OtherBot>,
pub discard_pile: Vec<Card>,
pub history: Vec<History>,
pub score: Score,
}
pub trait BotInterface {
fn get_name(&self) -> String;
fn on_turn(&self, _context: &Context) -> Action {
Action::Income
}
fn on_auto_coup(&self, context: &Context) -> String {
context
.playing_bots
.iter()
.find(|bot| bot.name != context.name)
.unwrap()
.name
.clone()
}
fn on_challenge_action_round(
&self,
_action: &Action,
_by: String,
_context: &Context,
) -> bool {
false
}
fn on_counter(
&self,
_action: &Action,
_by: String,
_context: &Context,
) -> bool {
false
}
fn on_challenge_counter_round(
&self,
_action: &Action,
_by: String,
_context: &Context,
) -> bool {
false
}
fn on_swapping_cards(
&self,
new_cards: [Card; 2],
_context: &Context,
) -> [Card; 2] {
new_cards
}
fn on_card_loss(&self, context: &Context) -> Card {
context.cards.clone().pop().unwrap()
}
}