C# Class SharpNeat.Domains.PreyCapture.PreyCaptureWorld

The prey capture task's grid world. Encapsulates agent's sensor and motor hardware and the prey's simple stochastic movement.
Afficher le fichier Open project: colgreen/sharpneat Class Usage Examples

Méthodes publiques

Méthode Description
InitPositions ( ) : void

Initialise agent and prey positions. The prey is positioned randomly with at least 4 empty squares between it and a wall (in all directions). The agent is positioned randomly but such that the prey is within sensor range (distance 2 or less).

IsPreyCaptured ( ) : bool

Gets a boolean that indicates if the prey has been captured.

MoveAgent ( IBlackBox agent ) : void

Allow the agent to move one square based on its decision. Note that the agent can choose to not move.

MovePrey ( ) : void

Move the prey. The prey moves by a simple set of stochastic rules that make it more likely to move away from the agent, and more so when it is close.

PreyCaptureWorld ( int gridSize, int preyInitMoves, double preySpeed, double sensorRange, int maxTimesteps ) : System

Constructs with the provided world parameter arguments.

RunTrial ( IBlackBox agent ) : bool

Runs one trial of the provided agent in the world. Returns true if the agent captures the prey within the maximum number of timesteps allowed.

SetAgentInputsAndActivate ( IBlackBox agent ) : void

Determine the agent's position in the world relative to the prey and walls, and set its sensor inputs accordingly.

Private Methods

Méthode Description
CalcAngleDelta ( double a, double b ) : double

Calculates minimum angle between two vectors (specified by angle only).

MovePrey_T ( double distance ) : double

Method Details

InitPositions() public méthode

Initialise agent and prey positions. The prey is positioned randomly with at least 4 empty squares between it and a wall (in all directions). The agent is positioned randomly but such that the prey is within sensor range (distance 2 or less).
public InitPositions ( ) : void
Résultat void

IsPreyCaptured() public méthode

Gets a boolean that indicates if the prey has been captured.
public IsPreyCaptured ( ) : bool
Résultat bool

MoveAgent() public méthode

Allow the agent to move one square based on its decision. Note that the agent can choose to not move.
public MoveAgent ( IBlackBox agent ) : void
agent IBlackBox
Résultat void

MovePrey() public méthode

Move the prey. The prey moves by a simple set of stochastic rules that make it more likely to move away from the agent, and more so when it is close.
public MovePrey ( ) : void
Résultat void

PreyCaptureWorld() public méthode

Constructs with the provided world parameter arguments.
public PreyCaptureWorld ( int gridSize, int preyInitMoves, double preySpeed, double sensorRange, int maxTimesteps ) : System
gridSize int
preyInitMoves int
preySpeed double
sensorRange double
maxTimesteps int
Résultat System

RunTrial() public méthode

Runs one trial of the provided agent in the world. Returns true if the agent captures the prey within the maximum number of timesteps allowed.
public RunTrial ( IBlackBox agent ) : bool
agent IBlackBox
Résultat bool

SetAgentInputsAndActivate() public méthode

Determine the agent's position in the world relative to the prey and walls, and set its sensor inputs accordingly.
public SetAgentInputsAndActivate ( IBlackBox agent ) : void
agent IBlackBox
Résultat void