rust_sc2

Trait Player

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

    // Provided methods
    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§

Source

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

Returns settings used to connect bot to the game.

Provided Methods§

Source

fn on_start(&mut self) -> SC2Result<()>

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

Source

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

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

Source

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

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

Source

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

Called when different events happen.

Implementors§