pub fn step(api: &mut Api<'_>) -> (bool, f32, bool)
Expand description

This function will be called by the framework on every step. Here you decide where to move next!

Use the provided Api object to interact with the world. It provides information about the world around you. See the documentation for more details.

Your action is specified via the tree return values, which are:

  • continue (bool): Whether your bot should keep running. Return false here for a controlled shutdown (your snake will die and respawn).
  • angle (f32): The angle relative to your last heading that you want to turn to (in radians, ±pi)
  • boost (bool): When set to true, your snake will get a speed boost, but this will cost some of the snake’s mass.