• 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 LineFormationParticleSync

    Basic line formation algorithm that assumes a connected system as well as common chirality and compass alignment. Designed to work in the fully synchronous execution model where all particles are activated in each round.

    The algorithm uses only 1 pin per edge.

    Inheritance
    object
    ParticleAlgorithm
    LineFormationParticleSync
    Namespace: AS2.Algos.LineFormation
    Assembly: .dll
    Syntax
    public class LineFormationParticleSync : ParticleAlgorithm

    Constructors

    LineFormationParticleSync(Particle)

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

    Fields

    beepInLastRound

    Declaration
    private ParticleAttribute<bool> beepInLastRound
    Field Value
    Type Description
    ParticleAttribute<bool>

    constructionDir

    Declaration
    public ParticleAttribute<Direction> constructionDir
    Field Value
    Type Description
    ParticleAttribute<Direction>

    finishedColor

    Declaration
    private static Color finishedColor
    Field Value
    Type Description
    Color

    flwrColor

    Declaration
    private static Color flwrColor
    Field Value
    Type Description
    Color

    followDir

    Declaration
    public ParticleAttribute<Direction> followDir
    Field Value
    Type Description
    ParticleAttribute<Direction>

    handoverBeepDirection

    Declaration
    private ParticleAttribute<Direction> handoverBeepDirection
    Field Value
    Type Description
    ParticleAttribute<Direction>

    hasChosenRoot

    Declaration
    private ParticleAttribute<bool> hasChosenRoot
    Field Value
    Type Description
    ParticleAttribute<bool>

    idleColor

    Declaration
    private static Color idleColor
    Field Value
    Type Description
    Color

    inlineColor

    Declaration
    private static Color inlineColor
    Field Value
    Type Description
    Color

    leaderColor

    Declaration
    private static Color leaderColor
    Field Value
    Type Description
    Color

    localLineComplete

    Declaration
    private ParticleAttribute<bool> localLineComplete
    Field Value
    Type Description
    ParticleAttribute<bool>

    moveDir

    Declaration
    public ParticleAttribute<Direction> moveDir
    Field Value
    Type Description
    ParticleAttribute<Direction>

    rootColor

    Declaration
    private static Color rootColor
    Field Value
    Type Description
    Color

    rootHandoverAvailable

    Declaration
    public ParticleAttribute<bool> rootHandoverAvailable
    Field Value
    Type Description
    ParticleAttribute<bool>

    state

    Declaration
    public ParticleAttribute<LineFormationParticleSync.LFState> state
    Field Value
    Type Description
    ParticleAttribute<LineFormationParticleSync.LFState>

    Properties

    GenerationMethod

    Declaration
    public static string GenerationMethod { get; }
    Property Value
    Type Description
    string

    Name

    Declaration
    public static string Name { get; }
    Property Value
    Type Description
    string

    PinsPerEdge

    The number of pins on each edge.

    This number must be the same constant for all particles.

    Declaration
    public override int PinsPerEdge { get; }
    Property Value
    Type Description
    int
    Overrides
    ParticleAlgorithm.PinsPerEdge

    Methods

    ActivateBeep()

    This is the second part of the main activation logic of the particle. It is called exactly once in each round, after the movements scheduled in ActivateMove() have been executed, and should contain the algorithm code that implements the look-compute-beep cycle.

    Inside of this method, particles are allowed to change their pin configuration and send beeps and messages on the updated configuration.

    Note that beeps and messages sent in the current round will be readable in both the ActivateMove() and ActivateBeep() calls in the next round.

    Declaration
    public override void ActivateBeep()
    Overrides
    ParticleAlgorithm.ActivateBeep()

    ActivateMove()

    This is one part of the main activation logic of the particle. It is called exactly once in each round and should contain the algorithm code that implements the look-compute-move cycle. After the movements are executed, ActivateBeep() is called within the same round.

    Inside of this method, particles are allowed to release bonds, define which bonds should be marked, and schedule movements. Only the last movement operation scheduled in this method will be applied.

    Declaration
    public override void ActivateMove()
    Overrides
    ParticleAlgorithm.ActivateMove()

    CheckLocalCompleteness()

    Checks if the line is locally complete.

    Declaration
    private bool CheckLocalCompleteness()
    Returns
    Type Description
    bool

    true if and only if the only neighbors are LEADER or INLINE particles directly in or directly opposite of the construction direction.

    ComputeRootMoveDir()

    Declaration
    private int ComputeRootMoveDir()
    Returns
    Type Description
    int

    ComputeRootMoveDir(Neighbor<LineFormationParticleSync>)

    Computes the next movement direction of the contracted ROOT particle and determines whether it is about to enter the end position of the line.

    Declaration
    private int ComputeRootMoveDir(Neighbor<LineFormationParticleSync> nbr)
    Parameters
    Type Name Description
    Neighbor<LineFormationParticleSync> nbr

    The INLINE or LEADER neighbor from which we can determine the movement direction.

    Returns
    Type Description
    int

    1 if we are about to enter the end position of the line from the left side, 2 if we are about to enter from the right side, and 0 otherwise.

    DrawPath(ParticleSystem, Particle)

    Declaration
    [StatusInfo("Draw FLWR Path", "Draws the follower path from the currently selected FLWR particle to its ROOT parent.", false)]
    public static void DrawPath(ParticleSystem system, Particle selected)
    Parameters
    Type Name Description
    ParticleSystem system
    Particle selected

    DrawSpanningTree(ParticleSystem, Particle)

    Declaration
    [StatusInfo("Draw Spanning Tree", "Draws the entire spanning tree, i.e., the parent edges for all FLWR particles.", true)]
    public static void DrawSpanningTree(ParticleSystem system, Particle selected)
    Parameters
    Type Name Description
    ParticleSystem system
    Particle selected

    FlwrBeep()

    Declaration
    private void FlwrBeep()

    FlwrMove()

    Declaration
    private void FlwrMove()

    HaveBlockingTailNeighbor()

    Declaration
    private bool HaveBlockingTailNeighbor()
    Returns
    Type Description
    bool

    IdleActivate()

    Declaration
    private void IdleActivate()

    Init(bool)

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

    InlineActivate()

    Declaration
    private void InlineActivate()

    IsFinished()

    Checks whether this particle has finished its algorithm.

    Override this method to return true when a particle is done executing the algorithm. Once all particles in the system are finished, the simulation will stop automatically. When a particle's state results in this method returning true, its activation methods should not change its state any more.

    Declaration
    public override bool IsFinished()
    Returns
    Type Description
    bool

    true if and only if this particle has finished its algorithm.

    Overrides
    ParticleAlgorithm.IsFinished()

    LeaderActivate()

    Declaration
    private void LeaderActivate()

    PullIfSentBeep()

    Assuming that we are expanded, check if we have received a beep on one of our tail edges incident to a contracted FLWR. If we have, that means that we have sent that beep and we can now pull the particle at that edge.

    Will perform the pull handover immediately.

    Declaration
    private bool PullIfSentBeep()
    Returns
    Type Description
    bool

    true if and only if we can perform the pull handover due to a beep on the corresponding edge.

    RootActivate()

    Declaration
    private void RootActivate()

    RootBeep()

    Declaration
    private void RootBeep()

    RootMove()

    Declaration
    private void RootMove()

    SendBeepForPull()

    Assuming that we are expanded, search for a contracted FLWR particle that is following our tail and send a beep in its direction if we find one. Schedules the beep using handoverBeepDirection so it can be sent in the next beep phase.

    In the next round, PullIfSentBeep() can be used to check if and where we have sent a beep and perform the corresponding pull handover.

    Declaration
    private bool SendBeepForPull()
    Returns
    Type Description
    bool

    true if and only if we can send a beep to a contracted FLWR following our tail.

    SendBeepToWaitingRoot()

    Procedure of LEADER and INLINE particles to decide which of the up to 2 waiting ROOT particles may move to the end position of the line. If this situation is detected and a decision can be made, a beep is sent to the chosen ROOT.

    Declaration
    private bool SendBeepToWaitingRoot()
    Returns
    Type Description
    bool

    true if and only if a ROOT particle was chosen or no ROOT particle will ever be chosen because the next position in the line is already occupied by an INLINE particle.

    TryToBecomeInline()

    Declaration
    private bool TryToBecomeInline()
    Returns
    Type Description
    bool

    TryToBecomeInline(Neighbor<LineFormationParticleSync>)

    Declaration
    private bool TryToBecomeInline(Neighbor<LineFormationParticleSync> nbr)
    Parameters
    Type Name Description
    Neighbor<LineFormationParticleSync> nbr
    Returns
    Type Description
    bool

    TryToBecomeRootOrInline()

    Searches for a neighbor in state INLINE or LEADER and goes to state INLINE if we are at the end of the line or state ROOT if we are not. If no such neighbor is found, the state does not change.

    Declaration
    private int TryToBecomeRootOrInline()
    Returns
    Type Description
    int

    2 if we are now INLINE, 1 if we are now a ROOT, 0 otherwise.

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