pub struct Colony { /* private fields */ }Expand description
The colony — manages agent lifecycle and simulation.
Implementations§
Source§impl Colony
impl Colony
pub fn new() -> Self
Sourcepub fn spawn(
&mut self,
agent: Box<dyn Agent<Input = String, Fragment = String, Presentation = Vec<String>>>,
) -> AgentId
pub fn spawn( &mut self, agent: Box<dyn Agent<Input = String, Fragment = String, Presentation = Vec<String>>>, ) -> AgentId
Spawn an agent into the colony.
Sourcepub fn ingest_document(
&mut self,
title: &str,
content: &str,
position: Position,
) -> DocumentId
pub fn ingest_document( &mut self, title: &str, content: &str, position: Position, ) -> DocumentId
Ingest a document into the substrate.
Places the document at the given position and emits an Input signal to attract nearby agents via chemotaxis.
Sourcepub fn tick(&mut self) -> Vec<ColonyEvent>
pub fn tick(&mut self) -> Vec<ColonyEvent>
Run a single simulation tick.
Sourcepub fn stats(&self) -> ColonyStats
pub fn stats(&self) -> ColonyStats
Get colony statistics.
Sourcepub fn substrate(&self) -> &SubstrateImpl
pub fn substrate(&self) -> &SubstrateImpl
Get a reference to the substrate.
Sourcepub fn substrate_mut(&mut self) -> &mut SubstrateImpl
pub fn substrate_mut(&mut self) -> &mut SubstrateImpl
Get a mutable reference to the substrate.
Sourcepub fn alive_count(&self) -> usize
pub fn alive_count(&self) -> usize
Number of agents currently alive.
Sourcepub fn death_signals(&self) -> &[DeathSignal]
pub fn death_signals(&self) -> &[DeathSignal]
All death signals collected during the simulation.
Sourcepub fn feed_agent(
&mut self,
agent_idx: usize,
input: String,
) -> Option<DigestionResult>
pub fn feed_agent( &mut self, agent_idx: usize, input: String, ) -> Option<DigestionResult>
Feed text input to a specific agent by index.
Sourcepub fn snapshot(&self) -> ColonySnapshot
pub fn snapshot(&self) -> ColonySnapshot
Take a serializable snapshot of the colony’s current state.
Sourcepub fn event_history(&self) -> &[(Tick, ColonyEvent)]
pub fn event_history(&self) -> &[(Tick, ColonyEvent)]
Get the full event history with tick numbers.
Sourcepub fn agents(
&self,
) -> &[Box<dyn Agent<Input = String, Fragment = String, Presentation = Vec<String>>>]
pub fn agents( &self, ) -> &[Box<dyn Agent<Input = String, Fragment = String, Presentation = Vec<String>>>]
Get a reference to the agents.
Sourcepub fn fitness_tracker(&self) -> &FitnessTracker
pub fn fitness_tracker(&self) -> &FitnessTracker
Get a reference to the fitness tracker.
Sourcepub fn fitness_tracker_mut(&mut self) -> &mut FitnessTracker
pub fn fitness_tracker_mut(&mut self) -> &mut FitnessTracker
Get a mutable reference to the fitness tracker.
Sourcepub fn emit_input_signal(&mut self, position: Position, intensity: f64)
pub fn emit_input_signal(&mut self, position: Position, intensity: f64)
Emit an input signal at a position (to attract agents).