Grid

constructor(width: Int, height: Int, initWithDatalessTiles: Boolean = true, debugTimeUse: Boolean = false, isSparse: Boolean = false)

Parameters

width

The width of the grid (number of columns).

height

The height of the grid (number of rows).

initWithDatalessTiles

If true, initializes the grid with empty tiles.

debugTimeUse

If true, prints the time use of algorithms to standard error. Defaults to false.

isSparse

If true, search results are stored in maps instead of arrays. More performant when searches only reach a small part of a large grid. Defaults to false.


constructor(stringGrid: List<String>, debugTimeUse: Boolean = false, isSparse: Boolean = false)

Construct the grid from a list of strings, where each string represents a row in the grid, and each character, a node.

Sets the grid height to the list size and the width to the length of the first string. Requires that all strings have the same length. If some cells should be deleted, deleteNodeAtXY(x,y) or deleteNodesWithData(data) can be used after the grid is created.

Parameters

stringGrid

A list of strings representing the grid

debugTimeUse

If true, the time taken by each graph algorithm is printed to the standard error stream. Defaults to false.

isSparse

If true, search results are stored in maps instead of arrays. Defaults to false.