Class Triangle
Implements the triangle primitive for reconfiguration.
See https://doi.org/10.4230/LIPIcs.SAND.2026.11.
The constant-time reconfiguration of an equilateral triangle where only the two sides (legs) are occupied by amoebots to a configuration where the base of the triangle and
one of the legs are occupied.
The algorithm consists of four phases: the first phase iteratively reduces the triangle, the second phase performs shearing operations to occupy the base of the triangle,
the third phase uses shearing operations to occupy the nodes adjacent to the base, and the fourth phase performs shearing operations to occupy one of the legs.
The algorithm also has the ability to drag an arm of amoebots attached to the "top" of the triangle along while reducing and shearing.
The arm is always assumed to be in lineDir, when an arm is present rotateOtherDir is required to be true.
Inheritance
object
Triangle
Assembly: .dll
Syntax
public class Triangle : Suboracle<Triangle>
Constructors
|
Edit this page
View Source
Triangle(Particle)
Declaration
public Triangle(Particle rep)
Parameters
Fields
|
Edit this page
View Source
allMembers
Declaration
private List<ParticleAlgorithm> allMembers
Field Value
|
Edit this page
View Source
anchor
Declaration
private ParticleAlgorithm anchor
Field Value
|
Edit this page
View Source
anchor2
Declaration
private ParticleAlgorithm anchor2
Field Value
|
Edit this page
View Source
arm
Declaration
private ParticleAlgorithm arm
Field Value
|
Edit this page
View Source
armParticles
Declaration
private List<ParticleAlgorithm> armParticles
Field Value
|
Edit this page
View Source
bank
Declaration
private List<ParticleAlgorithm> bank
Field Value
|
Edit this page
View Source
line
Declaration
private List<ParticleAlgorithm> line
Field Value
|
Edit this page
View Source
line2
Declaration
private List<ParticleAlgorithm> line2
Field Value
|
Edit this page
View Source
lineDir
Declaration
private Direction lineDir
Field Value
|
Edit this page
View Source
mirrored
Declaration
Field Value
|
Edit this page
View Source
phase
Declaration
private ParticleAttribute<Triangle.Phase> phase
Field Value
|
Edit this page
View Source
rotateOtherDir
Declaration
private bool rotateOtherDir
Field Value
|
Edit this page
View Source
round
Declaration
private ParticleAttribute<int> round
Field Value
|
Edit this page
View Source
shearSuboracle
Declaration
private Shear shearSuboracle
Field Value
|
Edit this page
View Source
shearSuboracle2
Declaration
private Shear shearSuboracle2
Field Value
|
Edit this page
View Source
shearSuboracle3
Declaration
private Shear shearSuboracle3
Field Value
|
Edit this page
View Source
shearSuboracle4
Declaration
private Shear shearSuboracle4
Field Value
|
Edit this page
View Source
x
Declaration
Field Value
|
Edit this page
View Source
y
Declaration
Field Value
Methods
|
Edit this page
View Source
HandleInitPhase()
Handles the initialization of the algorithm, detecting the legs of the triangle and the arm (if it exists)
The arm is always assumed to be in lineDir, when an arm is present rotateOtherDir is required to be true.
Declaration
private void HandleInitPhase()
|
Edit this page
View Source
HandlePhaseFour()
Handles the fourth phase of the algorithm, performing shearing operations to occupy one of the legs of the triangle
Declaration
private void HandlePhaseFour()
|
Edit this page
View Source
HandlePhaseOne()
Handles the first phase of the algorithm, reducing the triangle until the sidelength l = 1 or there is an even k such that l = 4k + 1
Declaration
private void HandlePhaseOne()
|
Edit this page
View Source
HandlePhaseThree()
Handles the third phase of the algorithm, performing shearing operations to occupy nodes adjacent to the base of the triangle
Declaration
private void HandlePhaseThree()
|
Edit this page
View Source
HandlePhaseTwo()
Handles the second phase of the algorithm, performing shearing operations to occupy the base of the triangle
Declaration
private void HandlePhaseTwo()
|
Edit this page
View Source
Init(List<Triangle>, ParticleAlgorithm, Direction, bool, bool)
Initializes the suboracle with the given members and direction
Declaration
public void Init(List<Triangle> memberParticles, ParticleAlgorithm anchor = null, Direction startDir = Direction.NONE, bool mirrored = false, bool rotateOtherDir = false)
Parameters
| Type |
Name |
Description |
| List<Triangle> |
memberParticles |
particles that are part of the triangle
|
| ParticleAlgorithm |
anchor |
optional anchor particle for the triangle, otherwise the representative particle
|
| Direction |
startDir |
the direction of the "left" leg of the triangle
|
| bool |
mirrored |
flag for mirroring the triangle
|
| bool |
rotateOtherDir |
flag for selecting the leg to be occupied in the end
|
|
Edit this page
View Source
OnActivate()
Activates the triangle suboracle, performing one step of the algorithm based on the current phase and round.
Declaration
protected override bool OnActivate()
Returns
| Type |
Description |
| bool |
true if the algorithm is finished, false otherwise
|
Overrides
|
Edit this page
View Source
removeBonds()
Removes bonds from members (except for the connection points) to non-member particles and unnecessary bonds for the bank particles
Declaration
private void removeBonds()