Skip to content

CellMatchContext ​

Namespace: Hex1b.Automation

Assembly: Hex1b.dll

Context provided to cell predicates during pattern matching. Contains information about the current position, cell, and match state.

csharp
public sealed class CellMatchContext

Inheritance ​

Object → CellMatchContext

Properties ​

Cell ​

The cell at the current position.

Returns: TerminalCell

csharp
public TerminalCell Cell { get; }

MatchStartCell ​

The first cell of this match (where Find() matched).

Returns: TerminalCell

csharp
public TerminalCell MatchStartCell { get; }

MatchStartPosition ​

The position where this match started.

Returns: ValueTuple<Int32, Int32>

csharp
public (int X, int Y) MatchStartPosition { get; }

PreviousCell ​

The cell from the previous step, or MatchStartCell if this is the first step after Find.

Returns: TerminalCell

csharp
public TerminalCell PreviousCell { get; }

PreviousPosition ​

The position of the previous step.

Returns: ValueTuple<Int32, Int32>

csharp
public (int X, int Y) PreviousPosition { get; }

Region ​

The region being searched.

Returns: IHex1bTerminalRegion

csharp
public IHex1bTerminalRegion Region { get; }

TraversedCells ​

All cells traversed so far in this match attempt.

Returns: IReadOnlyList<TraversedCell>

csharp
public IReadOnlyList<TraversedCell> TraversedCells { get; }

X ​

Current X position in the region.

Returns: Int32

csharp
public int X { get; }

Y ​

Current Y position in the region.

Returns: Int32

csharp
public int Y { get; }

Methods ​

GetAbsolute(int, int) ​

Gets the cell at an absolute position. Returns TerminalCell.Empty if out of bounds.

Parameters:

Returns: TerminalCell

csharp
public TerminalCell GetAbsolute(int x, int y)

GetRelative(int, int) ​

Gets the cell at a relative offset from current position. Returns TerminalCell.Empty if out of bounds.

Parameters:

Returns: TerminalCell

csharp
public TerminalCell GetRelative(int deltaX, int deltaY)

Released under the MIT License.