Class BoundaryTestParticle
Implementation of the inner outer boundary test from
https://arxiv.org/abs/2205.02610v1.
Common chirality and compass alignment are assumed. The particles
determine whether or not they are part of a boundary, elect a leader
on each boundary, and then test whether their boundary is an inner
or the outer boundary.
The phases are synchronized by periodic beeps on the global circuit
by particles that have not yet finished their current phase. All
particles terminate once the boundary test has finished on each
boundary.
The outer boundary's direction is counter-clockwise while the
direction of each inner boundary is clockwise.
Inheritance
BoundaryTestParticle
Assembly: .dll
Syntax
public class BoundaryTestParticle : ParticleAlgorithm
Constructors
BoundaryTestParticle(Particle)
Declaration
public BoundaryTestParticle(Particle p)
Parameters
Fields
activeColor
Declaration
private static readonly Color activeColor
Field Value
becomePassive
Declaration
private ParticleAttribute<bool>[] becomePassive
Field Value
boundaryAngles
Declaration
private ParticleAttribute<int>[] boundaryAngles
Field Value
boundaryNbrs
Declaration
private ParticleAttribute<int>[,] boundaryNbrs
Field Value
boundaryPC
Declaration
private ParticleAttribute<PinConfiguration> boundaryPC
Field Value
candidate1Color
Declaration
private static readonly Color candidate1Color
Field Value
candidate2Color
Declaration
private static readonly Color candidate2Color
Field Value
candidate3Color
Declaration
private static readonly Color candidate3Color
Field Value
firstActivation
Declaration
private ParticleAttribute<bool> firstActivation
Field Value
heads
Declaration
private ParticleAttribute<bool>[] heads
Field Value
isActive
Declaration
private ParticleAttribute<bool>[] isActive
Field Value
isCandidate
Declaration
private ParticleAttribute<bool>[] isCandidate
Field Value
isPhase2Candidate
Declaration
private ParticleAttribute<bool>[] isPhase2Candidate
Field Value
kappa
Declaration
private static readonly int kappa
Field Value
numBoundaries
Declaration
private ParticleAttribute<int> numBoundaries
Field Value
passiveColor
Declaration
private static readonly Color passiveColor
Field Value
phase
Declaration
private ParticleAttribute<Phase> phase
Field Value
phase2CandColor
Declaration
private static readonly Color phase2CandColor
Field Value
phase2Count
Declaration
private ParticleAttribute<int> phase2Count
Field Value
receivedHeadsBeep
Declaration
private ParticleAttribute<bool>[] receivedHeadsBeep
Field Value
retiredColor
Declaration
private static readonly Color retiredColor
Field Value
round
Declaration
private ParticleAttribute<int> round
Field Value
scMode
Declaration
private ParticleAttribute<SCMode>[] scMode
Field Value
startColor
Declaration
private static readonly Color startColor
Field Value
terminated
Declaration
private ParticleAttribute<bool> terminated
Field Value
Properties
Name
Declaration
public static string Name { get; }
Property Value
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
Overrides
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
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
FirstActivation()
Declaration
private void FirstActivation()
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
LE1Activate0()
Declaration
private void LE1Activate0()
LE1Activate1()
Declaration
private void LE1Activate1()
LE1Activate2()
Declaration
private void LE1Activate2()
LE2Activate0()
Declaration
private void LE2Activate0()
LE2Activate1()
Declaration
private void LE2Activate1()
LE2Activate2()
Declaration
private void LE2Activate2()
LE2Activate3()
Declaration
private void LE2Activate3()
LE2Activate4()
Declaration
private void LE2Activate4()
LEActivate1(bool)
Declaration
private void LEActivate1(bool phase2 = false)
Parameters
Type |
Name |
Description |
bool |
phase2 |
|
LEReceiveTails(bool)
Declaration
private bool LEReceiveTails(bool phase2 = false)
Parameters
Type |
Name |
Description |
bool |
phase2 |
|
Returns
SCActivate0()
Declaration
private void SCActivate0()
SCActivate1()
Declaration
private void SCActivate1()
SCActivate2()
Declaration
private void SCActivate2()
SCActivate345()
Declaration
private void SCActivate345()
SCActivate6()
Declaration
private void SCActivate6()
SetColor()
Declaration
SetGlobalCircuitAndBeep(bool)
Declaration
private void SetGlobalCircuitAndBeep(bool beep)
Parameters
Type |
Name |
Description |
bool |
beep |
|
SetPASCPinConfig()
Declaration
private void SetPASCPinConfig()
SetupBoundaryCircuit(ref PinConfiguration)
Declaration
private void SetupBoundaryCircuit(ref PinConfiguration pc)
Parameters
StartLERound(bool, bool)
Declaration
private void StartLERound(bool becomePhase2Cand = false, bool isPhase2Cand = false)
Parameters
Type |
Name |
Description |
bool |
becomePhase2Cand |
|
bool |
isPhase2Cand |
|
TossCoin(int)
Declaration
private bool TossCoin(int boundary)
Parameters
Type |
Name |
Description |
int |
boundary |
|
Returns