Engine of the Universe

async universe.engine.create_ant(ant_type: type, universe: Universe, update_callback: Callable) None[source]

Helper function to create an ant and append it to ants list.

Parameters:
  • ant_type (type) – The type of the ant.

  • universe (Universe) – The universe.

  • update_callback (Callable) – The callback function to update the frontend.

async universe.engine.initial_spawn(universe: Universe, update_callback: Callable) None[source]

Initial spawn of ants, nests and objects in the universe.

Parameters:
  • universe (Universe) – The universe.

  • update_callback (Callable) – The callback function to update the frontend.

async universe.engine.run(config: dict, update_callback: Callable | None = None) int[source]

Run the simulation.

Parameters:
  • config (dict) – The configuration of the simulation.

  • update_callback (Optional[Callable]) – The callback function to update the frontend.