C# Class social_learning.World

Show file Open project: tansey/social-learning Class Usage Examples

Public Methods

Method Description
Reset ( ) : void

Resets the world by calling reset on each agents and plant, then generating a new layout for the plants.

Step ( ) : void

Moves all agents in the world forward by one step and collects food for any agents on top of a plant.

World ( IEnumerable agents, int height, int width, IEnumerable species, IEnumerable predators, PlantLayoutStrategies layout = PlantLayoutStrategies.Uniform, int agentHorizon = DEFAULT_AGENT_HORIZON ) : System
calculateForagingAgentSensors ( IAgent agent ) : double[]
calculatePredatorSensors ( Predator predator ) : double[]

Private Methods

Method Description
applyToroidalAgentLocationRules ( IAgent agent ) : void

Forces the agent to stay on screen by wrapping them around the other side of the world if they run over an edge.

clusteredLayout ( ) : void
getSensorIndex ( IAgent agent, int offset, int pos ) : int
layoutPlants ( ) : void
onAgentEaten ( Predator eater, IAgent agent ) : void
onChanged ( EventArgs e ) : void
onPlantEaten ( IAgent eater, Plant plant ) : void
onStepped ( EventArgs e ) : void
spiralLayout ( ) : void
uniformLayout ( ) : void

Method Details

Reset() public method

Resets the world by calling reset on each agents and plant, then generating a new layout for the plants.
public Reset ( ) : void
return void

Step() public method

Moves all agents in the world forward by one step and collects food for any agents on top of a plant.
public Step ( ) : void
return void

World() public method

public World ( IEnumerable agents, int height, int width, IEnumerable species, IEnumerable predators, PlantLayoutStrategies layout = PlantLayoutStrategies.Uniform, int agentHorizon = DEFAULT_AGENT_HORIZON ) : System
agents IEnumerable
height int
width int
species IEnumerable
predators IEnumerable
layout PlantLayoutStrategies
agentHorizon int
return System

calculateForagingAgentSensors() public method

public calculateForagingAgentSensors ( IAgent agent ) : double[]
agent IAgent
return double[]

calculatePredatorSensors() public method

public calculatePredatorSensors ( Predator predator ) : double[]
predator Predator
return double[]