Class MonotoneToLine
Implements the Monotone2LineSegment algorithm (https://doi.org/10.4230/LIPIcs.SAND.2026.11). Reconfigures a monotone structure to a line structure in constant time.
The suboracle is called on its representative, but stores some data in its members ParticleAttributes.
"We call the intersection of the amoebot structure with a line parallel to the x-axis an x-section. Note that an x-section is not necessarily connected. We define y- and z-sections analogously. In particular, we also call x-sections rows, and y-sections columns. We call an amoebot structure x-monotone if and only each x-section is connected. We define y- and z-monotone analogously. We call an amoebot structure monotone if and only if it is x-monotone, y-monotone, or z-monotone."
Namespace: AS2.Suboracles.Reconfiguration
Assembly: .dll
Syntax
public class MonotoneToLine : Suboracle<MonotoneToLine>
Constructors
| Edit this page View SourceMonotoneToLine(Particle)
Declaration
public MonotoneToLine(Particle rep)
Parameters
| Type | Name | Description |
|---|---|---|
| Particle | rep |
Fields
| Edit this page View SourcelineVl
Declaration
private ParticleAttribute<bool> lineVl
Field Value
| Type | Description |
|---|---|
| ParticleAttribute<bool> |
lineVr
Declaration
private ParticleAttribute<bool> lineVr
Field Value
| Type | Description |
|---|---|
| ParticleAttribute<bool> |
round
Declaration
private ParticleAttribute<int> round
Field Value
| Type | Description |
|---|---|
| ParticleAttribute<int> |
subRule12
Declaration
private Rule12 subRule12
Field Value
| Type | Description |
|---|---|
| Rule12 |
subRule3abc
Declaration
private Rule3abc subRule3abc
Field Value
| Type | Description |
|---|---|
| Rule3abc |
subRule3de
Declaration
private Rule3de subRule3de
Field Value
| Type | Description |
|---|---|
| Rule3de |
xDir
Declaration
private Direction xDir
Field Value
| Type | Description |
|---|---|
| Direction |
yDir
Declaration
private Direction yDir
Field Value
| Type | Description |
|---|---|
| Direction |
zDir
Declaration
private Direction zDir
Field Value
| Type | Description |
|---|---|
| Direction |
Methods
| Edit this page View SourceColumnsCounts(ParticleAlgorithm[][])
Calculates the number of amoebots per column.
Declaration
private static int[] ColumnsCounts(ParticleAlgorithm[][] grid)
Parameters
| Type | Name | Description |
|---|---|---|
| ParticleAlgorithm[][] | grid | The particle grid |
Returns
| Type | Description |
|---|---|
| int[] | An array with the number of amoebots in each column |
GetBorderColor(Direction, MonotoneToLine)
Returns the color for the border in the given direction of an amoebot. Used for visualization. The border is green if the corresponding line bond is active, and transparent otherwise.
Declaration
public Color GetBorderColor(Direction dir, MonotoneToLine mv)
Parameters
| Type | Name | Description |
|---|---|---|
| Direction | dir | The direction for which the color is requested |
| MonotoneToLine | mv | The suboracle instance of the amoebot. |
Returns
| Type | Description |
|---|---|
| Color | Green if there is a bond |
Init(List<MonotoneToLine>, Direction, Direction, Direction)
Initializes the suboracle for a new run. It is assumed that the structure is y-monotone according to the given yDir.
Declaration
public void Init(List<MonotoneToLine> memberParticles, Direction xDir, Direction yDir, Direction zDir)
Parameters
| Type | Name | Description |
|---|---|---|
| List<MonotoneToLine> | memberParticles | The particles that are part of this suboracle instance. |
| Direction | xDir | The direction of the x-axis. |
| Direction | yDir | The direction of the y-axis. |
| Direction | zDir | The direction of the z-axis. |
OnActivate()
Execute the next round of the MonotoneToLine algorithm. Round 0: Initializes the line bonds and handles a special shift case. Round 1: Contracts particles after the shift. Round 2: Applies the reconfiguration rules (1, 2, 3a-e) to each column. Round 3: Waits for the sub-rules to complete and cleans up. The method returns true when the structure has been reconfigured into a line.
Declaration
protected override bool OnActivate()
Returns
| Type | Description |
|---|---|
| bool | True if the reconfiguration is complete, false otherwise. |