Search Results for

    Show / Hide Table of Contents

    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
    object
    Subroutine
    SubAddition
    SubBinOps
    SubComparison
    SubDivision
    SubMSBDetection
    SubMultiplication
    SubSubtraction
    SubBoundaryTest
    SubETT
    SubLeaderElection
    SubLeaderElectionFast
    SubLeaderElectionSync
    SubPASC
    SubPASC2
    Namespace: AS2.Subroutines
    Assembly: .dll
    Syntax
    public abstract class Subroutine

    Constructors

    | Edit this page View Source

    Subroutine(Particle)

    Declaration
    public Subroutine(Particle p)
    Parameters
    Type Name Description
    Particle p

    Fields

    | Edit this page View Source

    algo

    The algorithm instance to which this subroutine belongs.

    Declaration
    protected ParticleAlgorithm algo
    Field Value
    Type Description
    ParticleAlgorithm
    | Edit this page View Source

    particle

    The particle to which this subroutine belongs.

    Declaration
    protected Particle particle
    Field Value
    Type Description
    Particle

    Methods

    | Edit this page View Source

    ActivateBeep()

    The beep activation method of the subroutine. Not all subroutines require this method to be called.

    Declaration
    public virtual void ActivateBeep()
    | Edit this page View Source

    ActivateMove()

    The movement activation method of the subroutine. Not all subroutines require this method to be called.

    Declaration
    public virtual void ActivateMove()
    | Edit this page View Source

    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 name if the name is not taken yet, or name with an appended number to avoid duplicate attribute names.

    • Edit this page
    • View Source
    In this article
    Back to top AmoebotSim 2.0 Documentation v1.11
    Copyright © 2025 AmoebotSim 2.0 Authors
    Generated by DocFX