Search Results for

    Show / Hide Table of Contents

    Class ChiralityAndCompassParticle

    Implementation of the chirality agreement and compass alignment algorithms described in https://arxiv.org/abs/2105.05071v1. Both chirality and compasses can be random at initialization.

    Both phases use the following basic procedure:

    1. Find out which neighbors agree with the particle's chirality/compass direction and setup the pin configuration to contain all of these neighbors in one partition set. This establishes the regional circuit.
    2. Beep on the regional circuit if there is a neighbor particle that does not have the same chirality/compass direction. If no particle has beeped in this round, there is only one region and the algorithm can terminate.
    3. Let all candidates in the region perform a coin toss. All particles in the region observe the result, which can be HEADS, TAILS, or FAILED.
      If the result is FAILED, all candidates that tossed TAILS withdraw their candidacy. All boundary particles send the coin toss result to their neighbors that are not part of the region.
    4. Regions merge as follows: A region that tossed TAILS tries to merge into a neighboring region that has tossed anything other than TAILS. The boundary particles beep in reserved rounds if their neighboring region is a candidate for a merge. If a candidate exists, the first round in which a beep was sent determines how the merge can be performed. If no beeps are sent, no neighbor region was eligible and the next iteration starts. If a merge is performed, all candidates in the region withdraw.
    The algorithm is split into 7 individual rounds per iteration for the chirality agreement phase and 11 rounds per iteration for the compass alignment phase.
    Inheritance
    object
    ParticleAlgorithm
    ChiralityAndCompassParticle
    Namespace: AS2.Algos.ChiralityCompass
    Assembly: .dll
    Syntax
    public class ChiralityAndCompassParticle : ParticleAlgorithm

    Constructors

    | Edit this page View Source

    ChiralityAndCompassParticle(Particle)

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

    Fields

    | Edit this page View Source

    beepedForHeads

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

    chir0CandColor

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

    chir0CircuitColor

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

    chir0NoCandColor

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

    chir1CandColor

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

    chir1CircuitColor

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

    chir1NoCandColor

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

    chiralityAgreementPhase

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

    coinTossResult

    Declaration
    public ParticleAttribute<CoinTossResult> coinTossResult
    Field Value
    Type Description
    ParticleAttribute<CoinTossResult>
    | Edit this page View Source

    compCandColors

    Declaration
    private static readonly Color[] compCandColors
    Field Value
    Type Description
    Color[]
    | Edit this page View Source

    compNoCandColor

    Declaration
    private static readonly Color[] compNoCandColor
    Field Value
    Type Description
    Color[]
    | Edit this page View Source

    compassOffset

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

    finished

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

    firstActivation

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

    hasRegionalCircuit

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

    heads

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

    isCandidate

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

    mergeOffset

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

    nbrOffsets

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

    nbrs

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

    realChirality

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

    realCompassDir

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

    reverseChirality

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

    round

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

    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

    Activate0()

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

    Activate1()

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

    Activate10()

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

    Activate2()

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

    Activate3()

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

    Activate4()

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

    Activate5()

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

    Activate6()

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

    Activate7To9()

    Declaration
    private void Activate7To9()
    | 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

    CompassAlignmentUpdateMergeBeep(int)

    Declaration
    private void CompassAlignmentUpdateMergeBeep(int offset)
    Parameters
    Type Name Description
    int offset
    | Edit this page View Source

    Init(bool, Direction)

    Declaration
    public void Init(bool realChirality, Direction realCompassDir)
    Parameters
    Type Name Description
    bool realChirality
    Direction realCompassDir
    | 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

    SetColor()

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

    ToNewDir(Direction)

    Translates the given original local direction into the corresponding direction in the new system according to the current compass offset and chirality.

    Declaration
    private Direction ToNewDir(Direction dir)
    Parameters
    Type Name Description
    Direction dir

    The original local direction to be translated.

    Returns
    Type Description
    Direction

    The new local direction that corresponds to the given original direction dir with the current compass offset and chirality inversion applied.

    | Edit this page View Source

    TossCoin()

    Declaration
    private bool TossCoin()
    Returns
    Type Description
    bool
    • 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