Trait rust_sc2::Player[][src]

pub trait Player {
    fn get_player_settings(&self) -> PlayerSettings<'_>;

    fn on_start(&mut self) -> SC2Result<()> { ... }
fn on_step(&mut self, _iteration: usize) -> SC2Result<()> { ... }
fn on_end(&self, _result: GameResult) -> SC2Result<()> { ... }
fn on_event(&mut self, _event: Event) -> SC2Result<()> { ... } }
Expand description

Trait that bots must implement.

Required methods

fn get_player_settings(&self) -> PlayerSettings<'_>[src]

Returns settings used to connect bot to the game.

Provided methods

fn on_start(&mut self) -> SC2Result<()>[src]

Called once on first step (i.e on game start).

fn on_step(&mut self, _iteration: usize) -> SC2Result<()>[src]

Called on every game step. (Main logic of the bot should be here)

fn on_end(&self, _result: GameResult) -> SC2Result<()>[src]

Called once on last step with a result for your bot.

fn on_event(&mut self, _event: Event) -> SC2Result<()>[src]

Called when different events happen.

Implementors