Search Results for

    Show / Hide Table of Contents

    Class SubBoundaryTest

    Subroutine implementation of BoundaryTestParticle.

    Usage:

    • Initialize by calling Init(bool). All amoebots must participate in the subroutine.
    • Run SetupPC(PinConfiguration), then SetNextPinConfiguration(PinConfiguration) (if necessary) and ActivateSend() to start the procedure.
    • In the round immediately following a ActivateSend() call, ActivateReceive() must be called. There can be an arbitrary break until the next pin configuration setup and ActivateSend() call. Continue this until the procedure is finished.
    • You can call IsFinished() immediately after ActivateReceive() to check whether the procedure is finished. If it is, you can find the number of boundaries an amoebot is part of using NumBoundaries() and get boundary information with IsBoundaryLeader(int), IsOuterBoundary(int), GetBoundaryPredecessor(int) and GetBoundarySuccessor(int).
    Inheritance
    object
    Subroutine
    SubBoundaryTest
    Namespace: AS2.Subroutines.BoundaryTest
    Assembly: .dll
    Syntax
    public class SubBoundaryTest : Subroutine

    Constructors

    | Edit this page View Source

    SubBoundaryTest(Particle, SubPASC[])

    Declaration
    public SubBoundaryTest(Particle p, SubPASC[] pascInstances = null)
    Parameters
    Type Name Description
    Particle p
    SubPASC[] pascInstances

    Fields

    | Edit this page View Source

    angles

    Declaration
    private BinAttributeInt[] angles
    Field Value
    Type Description
    BinAttributeInt[]
    | Edit this page View Source

    auxCandidate

    Declaration
    private BinAttributeBool auxCandidate
    Field Value
    Type Description
    BinAttributeBool
    | Edit this page View Source

    boundaryCandidate

    Declaration
    private BinAttributeBitField boundaryCandidate
    Field Value
    Type Description
    BinAttributeBitField
    | Edit this page View Source

    boundaryDirs

    Declaration
    private BinAttributeDirection[] boundaryDirs
    Field Value
    Type Description
    BinAttributeDirection[]
    | Edit this page View Source

    coinTossHeads

    Declaration
    private BinAttributeBitField coinTossHeads
    Field Value
    Type Description
    BinAttributeBitField
    | Edit this page View Source

    controlColor

    Declaration
    private BinAttributeBool controlColor
    Field Value
    Type Description
    BinAttributeBool
    | Edit this page View Source

    finished

    Declaration
    private BinAttributeBool finished
    Field Value
    Type Description
    BinAttributeBool
    | Edit this page View Source

    innerBoundary

    Declaration
    private BinAttributeBitField innerBoundary
    Field Value
    Type Description
    BinAttributeBitField
    | Edit this page View Source

    innerBoundaryExists

    Declaration
    private BinAttributeBool innerBoundaryExists
    Field Value
    Type Description
    BinAttributeBool
    | Edit this page View Source

    iteration

    Declaration
    private BinAttributeInt iteration
    Field Value
    Type Description
    BinAttributeInt
    | Edit this page View Source

    kappa

    Declaration
    private static readonly int kappa
    Field Value
    Type Description
    int
    | Edit this page View Source

    numBoundaries

    Declaration
    private BinAttributeInt numBoundaries
    Field Value
    Type Description
    BinAttributeInt
    | Edit this page View Source

    pasc

    Declaration
    private SubPASC[] pasc
    Field Value
    Type Description
    SubPASC[]
    | Edit this page View Source

    round

    Declaration
    private BinAttributeInt round
    Field Value
    Type Description
    BinAttributeInt
    | Edit this page View Source

    state1

    Declaration
    private ParticleAttribute<int> state1
    Field Value
    Type Description
    ParticleAttribute<int>
    | Edit this page View Source

    state2

    Declaration
    private ParticleAttribute<int> state2
    Field Value
    Type Description
    ParticleAttribute<int>
    | Edit this page View Source

    successorBit

    Declaration
    private BinAttributeBitField successorBit
    Field Value
    Type Description
    BinAttributeBitField
    | Edit this page View Source

    successorExists

    Declaration
    private BinAttributeBitField successorExists
    Field Value
    Type Description
    BinAttributeBitField

    Methods

    | Edit this page View Source

    ActivateReceive()

    The first half of the subroutine activation. Must be called in the round immediately after ActivateSend() was called.

    Declaration
    public void ActivateReceive()
    | Edit this page View Source

    ActivateSend()

    The second half of the subroutine activation. Before this can be called, the pin configuration set up by SetupPC(PinConfiguration) must be planned.

    Declaration
    public void ActivateSend()
    | Edit this page View Source

    GetBoundaryPredecessor(int)

    Gets the predecessor direction on the given boundary.

    Declaration
    public Direction GetBoundaryPredecessor(int idx)
    Parameters
    Type Name Description
    int idx

    The boundary index to check.

    Returns
    Type Description
    Direction

    The direction pointing from this amoebot to its predecessor in a clockwise traversal of the boundary with index idx. Will be NONE if this amoebot does not have this boundary or the procedure is not finished.

    | Edit this page View Source

    GetBoundarySuccessor(int)

    Gets the successor direction on the given boundary.

    Declaration
    public Direction GetBoundarySuccessor(int idx)
    Parameters
    Type Name Description
    int idx

    The boundary index to check.

    Returns
    Type Description
    Direction

    The direction pointing from this amoebot to its successor in a clockwise traversal of the boundary with index idx. Will be NONE if this amoebot does not have this boundary or the procedure is not finished.

    | Edit this page View Source

    Init(bool)

    Initializes the subroutine. Must be called on all amoebots in the system.

    Declaration
    public void Init(bool controlColor = false)
    Parameters
    Type Name Description
    bool controlColor

    Whether the subroutine should control the color of this amoebot.

    | Edit this page View Source

    InnerBoundaryExists()

    Checks whether an inner boundary was found during the procedure.

    Declaration
    public bool InnerBoundaryExists()
    Returns
    Type Description
    bool

    true if and only if the procedure is finished and there is at least one inner boundary in the system.

    | Edit this page View Source

    IsBoundaryLeader(int)

    Checks whether this amoebot is the leader of the indicated boundary.

    Declaration
    public bool IsBoundaryLeader(int idx)
    Parameters
    Type Name Description
    int idx

    The boundary index to check.

    Returns
    Type Description
    bool

    true if and only if the procedure is finished and this amoebot is the leader of the boundary with index idx.

    | Edit this page View Source

    IsFinished()

    Checks whether the procedure is finished.

    Declaration
    public bool IsFinished()
    Returns
    Type Description
    bool

    true if and only if all boundaries have been identified.

    | Edit this page View Source

    IsOuterBoundary(int)

    Checks whether the boundary with the given index is the outer boundary.

    Declaration
    public bool IsOuterBoundary(int idx)
    Parameters
    Type Name Description
    int idx

    The boundary index to check.

    Returns
    Type Description
    bool

    true if and only if the procedure is finished and the boundary with index idx of this amoebot is the outer boundary.

    | Edit this page View Source

    IsOuterBoundaryLeader()

    Checks whether this amoebot is on the outer boundary leader.

    Declaration
    public bool IsOuterBoundaryLeader()
    Returns
    Type Description
    bool

    true if and only if this amoebot is the unique leader of the outer boundary.

    | Edit this page View Source

    NumBoundaries()

    Finds the number of boundaries this amoebot is on. If m is the number of boundaries, the boundary indices are 0,...,m-1.

    Declaration
    public int NumBoundaries()
    Returns
    Type Description
    int

    The number of boundaries this amoebot is a part of, or 0 if the procedure is not finished yet.

    | Edit this page View Source

    OnInnerBoundary()

    Checks whether this amoebot is on the inner boundary.

    Declaration
    public bool OnInnerBoundary()
    Returns
    Type Description
    bool

    true if and only if this amoebot is part of an inner boundary.

    | Edit this page View Source

    OnOuterBoundary()

    Checks whether this amoebot is on the outer boundary.

    Declaration
    public bool OnOuterBoundary()
    Returns
    Type Description
    bool

    true if and only if this amoebot is part of the outer boundary.

    | Edit this page View Source

    SetColor()

    Declaration
    private void SetColor()
    | Edit this page View Source

    SetupBoundaryCircuit(PinConfiguration, int, bool)

    Sets up one or two boundary circuits for the given boundary. The first circuit's partition set ID is boundaryIndex * 2 and the second ID is boundaryIndex * 2 + 1.

    Declaration
    private void SetupBoundaryCircuit(PinConfiguration pc, int boundaryIndex, bool addInner = true)
    Parameters
    Type Name Description
    PinConfiguration pc

    The pin configuration to modify.

    int boundaryIndex

    The index of the boundary for which to setup the circuit.

    bool addInner

    Whether the second "inner" circuit should be setup as well.

    | Edit this page View Source

    SetupGlobalCircuit(PinConfiguration, int, int)

    Sets up a global circuit using the given pin offset.

    Declaration
    private void SetupGlobalCircuit(PinConfiguration pc, int offset, int pSet)
    Parameters
    Type Name Description
    PinConfiguration pc

    The pin configuration to modify.

    int offset

    The pin offset.

    int pSet

    The partition set ID.

    | Edit this page View Source

    SetupPC(PinConfiguration)

    Sets up the pin configuration required for the ActivateSend() call. The next pin configuration is not set to another object by this method.

    Declaration
    public void SetupPC(PinConfiguration pc)
    Parameters
    Type Name Description
    PinConfiguration pc

    The pin configuration to modify.

    • 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