• Installation Guide
  • Amoebot Model
  • User Guide
  • Model Reference
  • Dev Guide
  • API Documentation
Search Results for

    Show / Hide Table of Contents
    • AS2
      • AlgorithmGenerator
      • AlgorithmGeneratorEditor
      • AlgorithmManager
      • AlgorithmManager.AlgorithmInfo
      • AmoebotFunctions
      • AmoebotSimulator
      • CameraUtils
      • CellRect
      • CellRect.CellRect_Iterator
      • ColorData
      • Config
      • ConfigData
      • ConfigData.AdditionalConfiguration
      • ConfigData.SettingsMenu
      • ConfigurationEditor
      • ConfigurationEditorBehavior
      • Constants
      • Direction
      • DirectionHelpers
      • EventDatabase
      • FileBrowser
      • FileBrowser.FileTypeHandler
      • FilePaths
      • InitModeSaveData
      • InitParticleSaveData
      • InitRandomWithHoles
      • Initialization
      • Initialization.Chirality
      • Initialization.Compass
      • InitializationMethod
      • InitializationMethod.DistanceSortedVectorList
      • InitializationMethodManager
      • InitializationMethodManager.AlgorithmInfo
      • InitializationStateSaveData
      • Log
      • MaterialDatabase
      • MessageSaveData
      • MinMax
      • MouseController
      • PSPlacementMode
      • ParticleAttributeEnumSaveData
      • ParticleAttributePCSaveData
      • ParticleAttributeSaveDataBase
      • ParticleAttributeSaveData<T>
      • ParticleObjectSaveData
      • ParticleStateSaveData
      • PinConfigurationHistorySaveData
      • PinConfigurationSaveData
      • RandomNumberGenerator
      • SaveStateUtility
      • SimulationStateSaveData
      • StatusInfoAttribute
      • TypeConverter
      • TypeConverter.ConversionResult
      • UIDatabase
      • ValueHistorySaveData<T>
    • AS2.Algos.BeepFailureTest
      • BeepFailureTestParticle
    • AS2.Algos.BinOpTest
      • BinOpTestInitializer
      • BinOpTestParticle
      • BinOpTestParticle.Mode
    • AS2.Algos.BoundaryTest
      • BoundaryTestParticle
      • Phase
      • SCMode
    • AS2.Algos.BoundaryTestSub
      • BoundaryTestSubParticle
    • AS2.Algos.ChiralityCompass
      • ChiralityAndCompassInitializer
      • ChiralityAndCompassParticle
      • CoinTossResult
      • DirectionMessage
    • AS2.Algos.CollisionTestAlgo
      • CollisionTestAlgoInitializer
      • CollisionTestAlgoParticle
    • AS2.Algos.CollisionTestAlgo2
      • CollisionTestAlgo2Initializer
      • CollisionTestAlgo2Particle
      • Role
    • AS2.Algos.ExpandedCircuitTest
      • ExpandedCircuitTestInitializer
      • ExpandedCircuitTestParticle
    • AS2.Algos.JMTest
      • JMTestInitializer
      • JMTestParticle
    • AS2.Algos.LeaderElection
      • LeaderElectionInitializer
      • LeaderElectionParticle
    • AS2.Algos.LineFormation
      • LineFormationInitializer
      • LineFormationParticleSync
      • LineFormationParticleSync.LFState
      • MyMessage
      • MyMessage.Direction
    • AS2.Algos.ObjectTest
      • ObjectTestInitializer
      • ObjectTestParticle
    • AS2.Algos.PASCTestAlgo
      • PASCTestAlgoInitializer
      • PASCTestAlgoParticle
    • AS2.Algos.SingleSourceSP
      • SingleSourceSPInitializer
      • SingleSourceSPParticle
      • SingleSourceSPParticle.Phase
    • AS2.Algos.SmartMaterial
      • SmartMaterialInitializer
      • SmartMaterialParticle
    • AS2.Algos.SubroutineTest
      • SubroutineTestInitializer
      • SubroutineTestParticle
    • AS2.Algos.SubroutineTest2
      • SubroutineTest2Initializer
      • SubroutineTest2Particle
    • AS2.Sim
      • ActionType
      • AlgorithmException
      • AmoebotSimException
      • BondMovementInfo
      • BondMovementInfoList
      • Circuit
      • CollisionChecker
      • CollisionChecker.DebugLine
      • EdgeMovement
      • IParticleAttribute
      • IParticleObject
      • IReplayHistory
      • InitializationParticle
      • InvalidActionException
      • JointMovementInfo
      • Message
      • Neighbor<T>
      • OpenInitParticle
      • Particle
      • ParticleAction
      • ParticleAlgorithm
      • ParticleAttributeBase
      • ParticleAttributeFactory
      • ParticleAttributeWithHistory<T>
      • ParticleAttribute_Bool
      • ParticleAttribute_Direction
      • ParticleAttribute_Enum<T>
      • ParticleAttribute_Float
      • ParticleAttribute_Int
      • ParticleAttribute_PinConfiguration
      • ParticleAttribute_String
      • ParticleAttribute<T>
      • ParticleException
      • ParticleFactory
      • ParticleObject
      • ParticleSystem
      • ParticleSystem_Utils
      • PartitionSet
      • Pin
      • PinConfiguration
      • SimulationException
      • SimulatorException
      • SimulatorStateException
      • SysPartitionSet
      • SysPin
      • SysPinConfiguration
      • ValueHistoryBondInfo
      • ValueHistoryJointMovement
      • ValueHistoryMessage
      • ValueHistoryPinConfiguration
      • ValueHistory<T>
    • AS2.Subroutines
      • Subroutine
    • AS2.Subroutines.BinStateHelpers
      • BinAttributeBitField
      • BinAttributeBool
      • BinAttributeDirection
      • BinAttributeEnum<T>
      • BinAttributeInt
      • BinAttribute<T>
    • AS2.Subroutines.BinaryOps
      • BinOpUtils
      • SubAddition
      • SubBinOps
      • SubBinOps.Mode
      • SubComparison
      • SubComparison.ComparisonResult
      • SubDivision
      • SubMSBDetection
      • SubMultiplication
      • SubSubtraction
    • AS2.Subroutines.BoundaryTest
      • SubBoundaryTest
    • AS2.Subroutines.ETT
      • Comparison
      • SubETT
    • AS2.Subroutines.LeaderElection
      • SubLeaderElection
    • AS2.Subroutines.LeaderElectionFast
      • SubLeaderElectionFast
    • AS2.Subroutines.LeaderElectionSync
      • SubLeaderElectionSync
    • AS2.Subroutines.PASC
      • SubPASC
      • SubPASC2
      • SubPASC2.NbrType
    • AS2.UI
      • ButtonHoldTrigger
      • ClickAction
      • ClickAction.ClickButton
      • ClickAction.ClickType
      • InitializationUIHandler
      • InputAction
      • InputAction.InputType
      • InputController
      • InputHandler
      • InputHandler.MouseState
      • InputManager
      • LineDrawer
      • LogUIHandler
      • LogUIHandler.EntryType
      • ObjectUIHandler
      • ParticleUIExtensionSmoothLerp
      • ParticleUIHandler
      • SettingsUIHandler
      • SizeFitter
      • Tooltip
      • TooltipHandler
      • UIHandler
      • UIHandler.UITool
      • UISetting
      • UISetting_Color
      • UISetting_Color.InputType
      • UISetting_Dropdown
      • UISetting_Header
      • UISetting_MinMax
      • UISetting_MinMax.InputType
      • UISetting_Slider
      • UISetting_Spacing
      • UISetting_Text
      • UISetting_Text.InputType
      • UISetting_Toggle
      • UISetting_ValueSlider
      • WorldSpaceBackgroundUIHandler
      • WorldSpaceUIHandler
      • WorldSpaceUIHandler.ParticleTextUIData
      • WorldSpaceUIHandler.TextType
    • AS2.Visuals
      • CircleDistributionCircleArea
      • CircleDistributionCircleLine
      • IGenerateDynamicMesh
      • IObjectInfo
      • IParticleGraphicsAdapter
      • IParticleState
      • InstancedDrawer
      • MaterialPropertyBlockData
      • MaterialPropertyBlockData_Circuits
      • MaterialPropertyBlockData_Objects
      • MaterialPropertyBlockData_Particles
      • MeshCreator_CircularView
      • MeshCreator_HexagonalView
      • ObjectGraphicsAdapter
      • ObjectGraphicsAdapter.VertexInfo
      • PSetDragHandler
      • ParticleBondGraphicState
      • ParticleGraphicsAdapterImpl
      • ParticleGraphicsAdapterImpl.ParticleMovement
      • ParticleGraphicsAdapterImpl.PositionSnap
      • ParticleJointMovementState
      • ParticleMovementState
      • ParticlePinGraphicState
      • ParticlePinGraphicState.CodeOverrideType_Node
      • ParticlePinGraphicState.NeighborPinConnection
      • ParticlePinGraphicState.PSetData
      • ParticlePinGraphicState.PSetData.GraphicalData
      • ParticlePinGraphicState.PSetData.GraphicalData.CodeOverrideType_PSet
      • ParticlePinGraphicState.PinDef
      • PartitionSetViewType
      • Polar2DCoordinate
      • PriorityQueue<T>
      • RenderBatchIndex
      • RenderSystem
      • RendererBackground
      • RendererCircuitPins_RenderBatch
      • RendererCircuitPins_RenderBatch.PropertyBlockData
      • RendererCircuitsAndBonds
      • RendererCircuits_Instance
      • RendererCircuits_Instance.GDRef
      • RendererCircuits_Instance.ParticleCircuitData
      • RendererCircuits_Instance.ParticleCircuitData.PSetInnerPinRef
      • RendererCircuits_Instance.ParticleCircuitData.PSetInnerPinRef.PinType
      • RendererCircuits_RenderBatch
      • RendererCircuits_RenderBatch.PropertyBlockData
      • RendererCircuits_RenderBatch.PropertyBlockData.ActiveState
      • RendererCircuits_RenderBatch.PropertyBlockData.LineType
      • RendererObjects
      • RendererParticles
      • RendererParticles_RenderBatch
      • RendererParticles_RenderBatch.PropertyBlockData
      • RendererUI
      • TextureCreator
      • ViewType
    • AS2.Visuals.Library
      • DegreeConstants
      • InterpolationConstants
      • MatrixConstants
      • MeshConstants
      • VectorConstants
      • BasicSample
      • CanvasSampleSaveFileImage
      • CanvasSampleSaveFileText
      • HexagonalExpansionPrototype

    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

    SubBoundaryTest(Particle, SubPASC[])

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

    Fields

    angles

    Declaration
    private BinAttributeInt[] angles
    Field Value
    Type Description
    BinAttributeInt[]

    auxCandidate

    Declaration
    private BinAttributeBool auxCandidate
    Field Value
    Type Description
    BinAttributeBool

    boundaryCandidate

    Declaration
    private BinAttributeBitField boundaryCandidate
    Field Value
    Type Description
    BinAttributeBitField

    boundaryDirs

    Declaration
    private BinAttributeDirection[] boundaryDirs
    Field Value
    Type Description
    BinAttributeDirection[]

    coinTossHeads

    Declaration
    private BinAttributeBitField coinTossHeads
    Field Value
    Type Description
    BinAttributeBitField

    controlColor

    Declaration
    private BinAttributeBool controlColor
    Field Value
    Type Description
    BinAttributeBool

    finished

    Declaration
    private BinAttributeBool finished
    Field Value
    Type Description
    BinAttributeBool

    innerBoundary

    Declaration
    private BinAttributeBitField innerBoundary
    Field Value
    Type Description
    BinAttributeBitField

    innerBoundaryExists

    Declaration
    private BinAttributeBool innerBoundaryExists
    Field Value
    Type Description
    BinAttributeBool

    iteration

    Declaration
    private BinAttributeInt iteration
    Field Value
    Type Description
    BinAttributeInt

    kappa

    Declaration
    private static readonly int kappa
    Field Value
    Type Description
    int

    numBoundaries

    Declaration
    private BinAttributeInt numBoundaries
    Field Value
    Type Description
    BinAttributeInt

    pasc

    Declaration
    private SubPASC[] pasc
    Field Value
    Type Description
    SubPASC[]

    round

    Declaration
    private BinAttributeInt round
    Field Value
    Type Description
    BinAttributeInt

    state1

    Declaration
    private ParticleAttribute<int> state1
    Field Value
    Type Description
    ParticleAttribute<int>

    state2

    Declaration
    private ParticleAttribute<int> state2
    Field Value
    Type Description
    ParticleAttribute<int>

    successorBit

    Declaration
    private BinAttributeBitField successorBit
    Field Value
    Type Description
    BinAttributeBitField

    successorExists

    Declaration
    private BinAttributeBitField successorExists
    Field Value
    Type Description
    BinAttributeBitField

    Methods

    ActivateReceive()

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

    Declaration
    public void ActivateReceive()

    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()

    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.

    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.

    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.

    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.

    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.

    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.

    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.

    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.

    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.

    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.

    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.

    SetColor()

    Declaration
    private void SetColor()

    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.

    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.

    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.

    In this article
    Back to top AmoebotSim 2.0 Documentation v1.11
    Copyright © 2025 AmoebotSim 2.0 Authors
    Generated by DocFX