Class Maze
The Maze class represents a maze
Implements
Inherited Members
Namespace: Maze.Api
Assembly: Maze.Api.dll
Syntax
public class Maze : IDisposable
Constructors
Maze(uint, uint)
Creates a new maze, or will throw an exception if the operation fails
Declaration
public Maze(uint rowCount, uint colCount)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | rowCount | Number of rows |
| uint | colCount | Number of columns |
Properties
ColCount
The number of columns currently in the maze
Declaration
public uint ColCount { get; }
Property Value
| Type | Description |
|---|---|
| uint | Number of columns |
Interop
The current Maze.Wasm.Interop associated with the object
Declaration
public MazeWasmInterop Interop { get; }
Property Value
| Type | Description |
|---|---|
| MazeWasmInterop | Maze.Wasm.Interop instance |
IsEmpty
Whether the maze is empty
Declaration
public bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| bool | Boolean |
RowCount
The number of rows currently in the maze
Declaration
public uint RowCount { get; }
Property Value
| Type | Description |
|---|---|
| uint | Number of rows |
UseStaticInterop
Controls whether the object uses a statically defined Maze.Wasm.Interop instance (default = true). If
false, then the maze determines the current instance on a per-API call basis.
Declaration
public static bool UseStaticInterop { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | Boolean |
Methods
DeleteCols(uint, uint)
Deletes columns from the maze, or will throw an exception if the columns cannot be deleted
Declaration
public void DeleteCols(uint startCol, uint count)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | startCol | Target start column |
| uint | count | Number columns to delete |
DeleteRows(uint, uint)
Deletes rows from the maze, or will throw an exception if the rows cannot be deleted
Declaration
public void DeleteRows(uint startRow, uint count)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | startRow | Target start row |
| uint | count | Number rows to delete |
Dispose()
Handles object disposal, releasing managed and unmanaged Maze.Wasm.Interop resources and marking the object as having been finalized
Declaration
public void Dispose()
Dispose(bool)
Handles object disposal
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | Flag indicating whether the object should be fully disposed (ie. including managed as well as unmanaged resources) |
~Maze()
Handles object finalization (deletion)
Declaration
protected ~Maze()
FromJson(string)
Reinitialises a maze from a JSON string, or will throw an exception if the operation fails
Declaration
public void FromJson(string json)
Parameters
| Type | Name | Description |
|---|---|---|
| string | json | JSON string |
GetCellType(uint, uint)
Gets the cell type associated with a cell within the maze, or will throw an exception if the cell type cannot be determined
Declaration
public Maze.CellType GetCellType(uint row, uint column)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | row | Target row |
| uint | column | Target column |
Returns
| Type | Description |
|---|---|
| Maze.CellType | Cell type |
GetFinishCell()
Gets the finish cell associated with the maze, or will throw an exception if the finish cell cannot be retrieved
Declaration
public Maze.Point GetFinishCell()
Returns
| Type | Description |
|---|---|
| Maze.Point | Finish cell point |
GetStartCell()
Gets the start cell associated with the maze, or will throw an exception if the start cell cannot be retrieved
Declaration
public Maze.Point GetStartCell()
Returns
| Type | Description |
|---|---|
| Maze.Point | Start cell point |
InsertCols(uint, uint)
Inserts columns into the maze, or will throw an exception if the columns cannot be inserted
Declaration
public void InsertCols(uint startCol, uint count)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | startCol | Target start column |
| uint | count | Number columns to insert |
InsertRows(uint, uint)
Inserts rows into the maze, or will throw an exception if the rows cannot be inserted
Declaration
public void InsertRows(uint startRow, uint count)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | startRow | Target start row |
| uint | count | Number rows to insert |
Reset()
Resets the maze to empty
Declaration
public void Reset()
Resize(uint, uint)
Resizes the maze
Declaration
public void Resize(uint newRowCount, uint newColCount)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | newRowCount | New number of rows |
| uint | newColCount | New number of columns |
SetFinishCell(uint, uint)
Sets the finish cell associated with the maze, or will throw an exception if the finish cell cannot be set
Declaration
public void SetFinishCell(uint finishRow, uint finishCol)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | finishRow | New finish cell row |
| uint | finishCol | New finsh cell column |
SetStartCell(uint, uint)
Sets the start cell associated with the maze, or will throw an exception if the start cell cannot be set
Declaration
public void SetStartCell(uint startRow, uint startCol)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | startRow | New start cell row |
| uint | startCol | New start cell column |
SetWallCells(uint, uint, uint, uint)
Sets a range of cells to walls within a maze, or will throw an exception if the walls cannot be set
Declaration
public void SetWallCells(uint startRow, uint startCol, uint endRow, uint endCol)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | startRow | Target start row |
| uint | startCol | Target start column |
| uint | endRow | Target end row |
| uint | endCol | Target end column |
Solve()
Solves a maze, else will throw an exception if the operation fails.
Declaration
public Solution Solve()
Returns
| Type | Description |
|---|---|
| Solution | Maze solution |
ToJson()
Converts a maze to a JSON string, or will throw an exception if the operation fails
Declaration
public string ToJson()
Returns
| Type | Description |
|---|---|
| string | JSON string |
ToMazePoint(MazeWasmPoint)
Converts a MazeWasmPoint to a Maze.Point
Declaration
public static Maze.Point ToMazePoint(MazeWasmInterop.MazeWasmPoint wasmPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| MazeWasmInterop.MazeWasmPoint | wasmPoint | Point to be converted |
Returns
| Type | Description |
|---|---|
| Maze.Point | The resultant Maze.Point |
ToMazePoints(List<MazeWasmPoint>)
Converts a list of MazeWasmPoint points to a list of Maze.Point points
Declaration
public static List<Maze.Point> ToMazePoints(List<MazeWasmInterop.MazeWasmPoint> wasmPoints)
Parameters
| Type | Name | Description |
|---|---|---|
| List<MazeWasmInterop.MazeWasmPoint> | wasmPoints | List of MazeWasmPoint points to be converted |
Returns
| Type | Description |
|---|---|
| List<Maze.Point> | List of Maze.Point points |