Class Subroutine
Abstract base class for subroutines.
A subroutine is an object that encapsulates an algorithm so that it can be reused easily. Subroutine objects must be instantiated in the algorithm's constructor, after the attributes have been created, because they create their own attributes and register them in the particle. Typically, a subroutine has an initialization method that sets up the computation, after which its activation methods can be called in each round to run the algorithm.
Inheritance
Namespace: AS2.Subroutines
Assembly: .dll
Syntax
public abstract class Subroutine
Constructors
Subroutine(Particle)
Declaration
public Subroutine(Particle p)
Parameters
Type | Name | Description |
---|---|---|
Particle | p |
Fields
algo
The algorithm instance to which this subroutine belongs.
Declaration
protected ParticleAlgorithm algo
Field Value
Type | Description |
---|---|
ParticleAlgorithm |
particle
The particle to which this subroutine belongs.
Declaration
protected Particle particle
Field Value
Type | Description |
---|---|
Particle |
Methods
ActivateBeep()
The beep activation method of the subroutine. Not all subroutines require this method to be called.
Declaration
public virtual void ActivateBeep()
ActivateMove()
The movement activation method of the subroutine. Not all subroutines require this method to be called.
Declaration
public virtual void ActivateMove()
FindValidAttributeName(string)
Finds an attribute name that is not taken yet by appending a number to the end of the given name.
Declaration
protected string FindValidAttributeName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The base name of the attribute. |
Returns
Type | Description |
---|---|
string | Either |