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
object
BoundaryTestParticle
Assembly: .dll
Syntax
public class BoundaryTestParticle : ParticleAlgorithm
Constructors
|
Edit this page
View Source
BoundaryTestParticle(Particle)
Declaration
public BoundaryTestParticle(Particle p)
Parameters
Fields
|
Edit this page
View Source
activeColor
Declaration
private static readonly Color activeColor
Field Value
|
Edit this page
View Source
becomePassive
Declaration
private ParticleAttribute<bool>[] becomePassive
Field Value
|
Edit this page
View Source
boundaryAngles
Declaration
private ParticleAttribute<int>[] boundaryAngles
Field Value
|
Edit this page
View Source
boundaryNbrs
Declaration
private ParticleAttribute<int>[,] boundaryNbrs
Field Value
|
Edit this page
View Source
boundaryPC
Declaration
private ParticleAttribute<PinConfiguration> boundaryPC
Field Value
|
Edit this page
View Source
candidate1Color
Declaration
private static readonly Color candidate1Color
Field Value
|
Edit this page
View Source
candidate2Color
Declaration
private static readonly Color candidate2Color
Field Value
|
Edit this page
View Source
candidate3Color
Declaration
private static readonly Color candidate3Color
Field Value
|
Edit this page
View Source
firstActivation
Declaration
private ParticleAttribute<bool> firstActivation
Field Value
|
Edit this page
View Source
heads
Declaration
private ParticleAttribute<bool>[] heads
Field Value
|
Edit this page
View Source
isActive
Declaration
private ParticleAttribute<bool>[] isActive
Field Value
|
Edit this page
View Source
isCandidate
Declaration
private ParticleAttribute<bool>[] isCandidate
Field Value
|
Edit this page
View Source
isPhase2Candidate
Declaration
private ParticleAttribute<bool>[] isPhase2Candidate
Field Value
|
Edit this page
View Source
kappa
Declaration
private static readonly int kappa
Field Value
|
Edit this page
View Source
numBoundaries
Declaration
private ParticleAttribute<int> numBoundaries
Field Value
|
Edit this page
View Source
passiveColor
Declaration
private static readonly Color passiveColor
Field Value
|
Edit this page
View Source
phase
Declaration
private ParticleAttribute<Phase> phase
Field Value
|
Edit this page
View Source
phase2CandColor
Declaration
private static readonly Color phase2CandColor
Field Value
|
Edit this page
View Source
phase2Count
Declaration
private ParticleAttribute<int> phase2Count
Field Value
|
Edit this page
View Source
receivedHeadsBeep
Declaration
private ParticleAttribute<bool>[] receivedHeadsBeep
Field Value
|
Edit this page
View Source
retiredColor
Declaration
private static readonly Color retiredColor
Field Value
|
Edit this page
View Source
round
Declaration
private ParticleAttribute<int> round
Field Value
|
Edit this page
View Source
scMode
Declaration
private ParticleAttribute<SCMode>[] scMode
Field Value
|
Edit this page
View Source
startColor
Declaration
private static readonly Color startColor
Field Value
|
Edit this page
View Source
terminated
Declaration
private ParticleAttribute<bool> terminated
Field Value
Properties
|
Edit this page
View Source
Name
Declaration
public static string Name { get; }
Property Value
|
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
Overrides
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
|
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
|
Edit this page
View Source
FirstActivation()
Declaration
private void FirstActivation()
|
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
|
Edit this page
View Source
LE1Activate0()
Declaration
private void LE1Activate0()
|
Edit this page
View Source
LE1Activate1()
Declaration
private void LE1Activate1()
|
Edit this page
View Source
LE1Activate2()
Declaration
private void LE1Activate2()
|
Edit this page
View Source
LE2Activate0()
Declaration
private void LE2Activate0()
|
Edit this page
View Source
LE2Activate1()
Declaration
private void LE2Activate1()
|
Edit this page
View Source
LE2Activate2()
Declaration
private void LE2Activate2()
|
Edit this page
View Source
LE2Activate3()
Declaration
private void LE2Activate3()
|
Edit this page
View Source
LE2Activate4()
Declaration
private void LE2Activate4()
|
Edit this page
View Source
LEActivate1(bool)
Declaration
private void LEActivate1(bool phase2 = false)
Parameters
Type |
Name |
Description |
bool |
phase2 |
|
|
Edit this page
View Source
LEReceiveTails(bool)
Declaration
private bool LEReceiveTails(bool phase2 = false)
Parameters
Type |
Name |
Description |
bool |
phase2 |
|
Returns
|
Edit this page
View Source
SCActivate0()
Declaration
private void SCActivate0()
|
Edit this page
View Source
SCActivate1()
Declaration
private void SCActivate1()
|
Edit this page
View Source
SCActivate2()
Declaration
private void SCActivate2()
|
Edit this page
View Source
SCActivate345()
Declaration
private void SCActivate345()
|
Edit this page
View Source
SCActivate6()
Declaration
private void SCActivate6()
|
Edit this page
View Source
SetColor()
Declaration
|
Edit this page
View Source
SetGlobalCircuitAndBeep(bool)
Declaration
private void SetGlobalCircuitAndBeep(bool beep)
Parameters
Type |
Name |
Description |
bool |
beep |
|
|
Edit this page
View Source
SetPASCPinConfig()
Declaration
private void SetPASCPinConfig()
|
Edit this page
View Source
SetupBoundaryCircuit(ref PinConfiguration)
Declaration
private void SetupBoundaryCircuit(ref PinConfiguration pc)
Parameters
|
Edit this page
View Source
StartLERound(bool, bool)
Declaration
private void StartLERound(bool becomePhase2Cand = false, bool isPhase2Cand = false)
Parameters
Type |
Name |
Description |
bool |
becomePhase2Cand |
|
bool |
isPhase2Cand |
|
|
Edit this page
View Source
TossCoin(int)
Declaration
private bool TossCoin(int boundary)
Parameters
Type |
Name |
Description |
int |
boundary |
|
Returns