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§
Sourcefn get_player_settings(&self) -> PlayerSettings<'_>
fn get_player_settings(&self) -> PlayerSettings<'_>
Returns settings used to connect bot to the game.
Provided Methods§
Sourcefn on_step(&mut self, _iteration: usize) -> SC2Result<()>
fn on_step(&mut self, _iteration: usize) -> SC2Result<()>
Called on every game step. (Main logic of the bot should be here)
Sourcefn on_end(&self, _result: GameResult) -> SC2Result<()>
fn on_end(&self, _result: GameResult) -> SC2Result<()>
Called once on last step with a result for your bot.