Class Spiral
Implements the Spiral2LineSegment algorithm.
See https://doi.org/10.4230/LIPIcs.SAND.2026.11.
Reconfigures a spiral structure into a straight line while strictly preserving the sequence order of the amoebots.
The algorithm achieves constant time by first converting the spiral into a y-monotone structure. It constructs a base line,
safely disconnects outer segments into independent arms, and aligns them in parallel using shearing operations.
The final monotone structure is then straightened using the Monotone2Line algorithm.
Inheritance
object
Spiral
Assembly: .dll
Syntax
public class Spiral : Suboracle<Spiral>
Constructors
|
Edit this page
View Source
Spiral(Particle)
Declaration
public Spiral(Particle rep)
Parameters
Fields
|
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 ParticleAttribute<bool> arm
Field Value
|
Edit this page
View Source
baseline
Declaration
private ParticleAttribute<bool> baseline
Field Value
|
Edit this page
View Source
clockwise
Declaration
Field Value
|
Edit this page
View Source
Declaration
private ParticleAttribute<Direction> directionExtra
Field Value
|
Edit this page
View Source
directionIn
Declaration
private ParticleAttribute<Direction> directionIn
Field Value
|
Edit this page
View Source
directionOut
Declaration
private ParticleAttribute<Direction> directionOut
Field Value
|
Edit this page
View Source
emptyLeft
Declaration
private ParticleAttribute<int> emptyLeft
Field Value
|
Edit this page
View Source
emptyRight
Declaration
private ParticleAttribute<int> emptyRight
Field Value
|
Edit this page
View Source
hideBonds
Declaration
private List<ParticleAlgorithm> hideBonds
Field Value
|
Edit this page
View Source
id
Declaration
private ParticleAttribute<int> id
Field Value
|
Edit this page
View Source
leftBaseline
Declaration
private ParticleAttribute<bool> leftBaseline
Field Value
|
Edit this page
View Source
leftBaselineMembers
Declaration
private List<ParticleAlgorithm> leftBaselineMembers
Field Value
|
Edit this page
View Source
leftCorners
Declaration
private List<Spiral> leftCorners
Field Value
|
Edit this page
View Source
monotoneToLineSuboracle
Declaration
private MonotoneToLine monotoneToLineSuboracle
Field Value
|
Edit this page
View Source
parallelogramSuboracle
Declaration
private Parallelogram parallelogramSuboracle
Field Value
|
Edit this page
View Source
releasedBonds
Declaration
private List<(ParticleAlgorithm, Direction, bool)> releasedBonds
Field Value
|
Edit this page
View Source
releasedBonds2
Declaration
private List<(ParticleAlgorithm, Direction, bool)> releasedBonds2
Field Value
|
Edit this page
View Source
rightBaseline
Declaration
private ParticleAttribute<bool> rightBaseline
Field Value
|
Edit this page
View Source
rightBaselineMembers
Declaration
private List<ParticleAlgorithm> rightBaselineMembers
Field Value
|
Edit this page
View Source
rightCorners
Declaration
private List<Spiral> rightCorners
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
shearSuboracleAnchors
Declaration
private List<Spiral> shearSuboracleAnchors
Field Value
|
Edit this page
View Source
trapezoidSuboracle
Declaration
private Trapezoid trapezoidSuboracle
Field Value
|
Edit this page
View Source
unrollingOnly
Declaration
private ParticleAttribute<bool> unrollingOnly
Field Value
|
Edit this page
View Source
unrollingSuboracle
Declaration
private Unrolling unrollingSuboracle
Field Value
|
Edit this page
View Source
xDir
Declaration
Field Value
|
Edit this page
View Source
yDir
Declaration
Field Value
|
Edit this page
View Source
zDir
Declaration
Field Value
Methods
|
Edit this page
View Source
GetBorderColor(Direction, Spiral)
Returns the color for the border in the given direction of an amoebot. Used for visualization.
If the monotone-to-line suboracle is active, delegates to it.
Otherwise, the color represents the spiral bonds: the border is blue for the incoming direction,
red for the outgoing direction, green for additional bonds created during the transformation.
Declaration
public Color GetBorderColor(Direction dir, Spiral mv)
Parameters
| Type |
Name |
Description |
| Direction |
dir |
The direction for which the color is requested.
|
| Spiral |
mv |
The suboracle instance of the amoebot.
|
Returns
| Type |
Description |
| Color |
Blue for directionIn, red for directionOut, green for directionExtra, transparent otherwise.
|
|
Edit this page
View Source
Init(List<Spiral>, ParticleAlgorithm, Direction, bool)
Initializes the suboracle for a new run.
Assigns IDs to all member particles in the spiral direction with 0 in the center,
sets their directionIn and directionOut attributes and determines the coordinate axes.
Also checks whether extra unrolling is needed for the last x-segment to allow subsequent parallelogram moves.
Fallback to only unrolling if there are less than 5 segments.
Declaration
public void Init(List<Spiral> memberParticles, ParticleAlgorithm outer, Direction startDir, bool clockwise)
Parameters
| Type |
Name |
Description |
| List<Spiral> |
memberParticles |
The particles that are part of this suboracle instance.
|
| ParticleAlgorithm |
outer |
The outermost particle of the spiral.
|
| Direction |
startDir |
The starting direction from the outermost particle towards the center.
|
| bool |
clockwise |
Whether the spiral turns clockwise.
|
|
Edit this page
View Source
OnActivate()
Execute the next round of the Spiral algorithm.
The method returns true when the structure has been reconfigured into a line.
True if the reconfiguration is complete, false otherwise.
Declaration
protected override bool OnActivate()
Returns
Overrides
|
Edit this page
View Source
RemoveBonds()
Removes all bonds from the particles in the hideBonds list, except for the bonds in the directionIn, directionOut, and directionExtra of each particle.
Also handles a few special cases.
Declaration
private void RemoveBonds()