Search Results for

    Show / Hide Table of Contents

    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

    | Edit this page View Source

    LineFormationParticleSync(Particle)

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

    Fields

    | Edit this page View Source

    beepInLastRound

    Declaration
    private ParticleAttribute<bool> beepInLastRound
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    constructionDir

    Declaration
    public ParticleAttribute<Direction> constructionDir
    Field Value
    Type Description
    ParticleAttribute<Direction>
    | Edit this page View Source

    finishedColor

    Declaration
    private static Color finishedColor
    Field Value
    Type Description
    Color
    | Edit this page View Source

    flwrColor

    Declaration
    private static Color flwrColor
    Field Value
    Type Description
    Color
    | Edit this page View Source

    followDir

    Declaration
    public ParticleAttribute<Direction> followDir
    Field Value
    Type Description
    ParticleAttribute<Direction>
    | Edit this page View Source

    handoverBeepDirection

    Declaration
    private ParticleAttribute<Direction> handoverBeepDirection
    Field Value
    Type Description
    ParticleAttribute<Direction>
    | Edit this page View Source

    hasChosenRoot

    Declaration
    private ParticleAttribute<bool> hasChosenRoot
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    idleColor

    Declaration
    private static Color idleColor
    Field Value
    Type Description
    Color
    | Edit this page View Source

    inlineColor

    Declaration
    private static Color inlineColor
    Field Value
    Type Description
    Color
    | Edit this page View Source

    leaderColor

    Declaration
    private static Color leaderColor
    Field Value
    Type Description
    Color
    | Edit this page View Source

    localLineComplete

    Declaration
    private ParticleAttribute<bool> localLineComplete
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    moveDir

    Declaration
    public ParticleAttribute<Direction> moveDir
    Field Value
    Type Description
    ParticleAttribute<Direction>
    | Edit this page View Source

    rootColor

    Declaration
    private static Color rootColor
    Field Value
    Type Description
    Color
    | Edit this page View Source

    rootHandoverAvailable

    Declaration
    public ParticleAttribute<bool> rootHandoverAvailable
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    state

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

    Properties

    | Edit this page View Source

    GenerationMethod

    Declaration
    public static string GenerationMethod { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Name

    Declaration
    public static string Name { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    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

    | Edit this page View Source

    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()
    | Edit this page View Source

    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()
    | Edit this page View Source

    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.

    | Edit this page View Source

    ComputeRootMoveDir()

    Declaration
    private int ComputeRootMoveDir()
    Returns
    Type Description
    int
    | Edit this page View Source

    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.

    | Edit this page View Source

    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
    | Edit this page View Source

    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
    | Edit this page View Source

    FlwrBeep()

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

    FlwrMove()

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

    HaveBlockingTailNeighbor()

    Declaration
    private bool HaveBlockingTailNeighbor()
    Returns
    Type Description
    bool
    | Edit this page View Source

    IdleActivate()

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

    Init(bool)

    Declaration
    public void Init(bool leader = false)
    Parameters
    Type Name Description
    bool leader
    | Edit this page View Source

    InlineActivate()

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

    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()
    | Edit this page View Source

    LeaderActivate()

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

    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.

    | Edit this page View Source

    RootActivate()

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

    RootBeep()

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

    RootMove()

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

    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.

    | Edit this page View Source

    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.

    | Edit this page View Source

    TryToBecomeInline()

    Declaration
    private bool TryToBecomeInline()
    Returns
    Type Description
    bool
    | Edit this page View Source

    TryToBecomeInline(Neighbor<LineFormationParticleSync>)

    Declaration
    private bool TryToBecomeInline(Neighbor<LineFormationParticleSync> nbr)
    Parameters
    Type Name Description
    Neighbor<LineFormationParticleSync> nbr
    Returns
    Type Description
    bool
    | Edit this page View Source

    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.

    • 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