visualize Grid
Visualizes the grid and optionally its traversal process using a graphical interface.
Distances are visualized by color gradients, with closer nodes appearing in warmer colors (red), and farther nodes in cooler colors (blue). Deleted nodes are represented as white tiles, while unvisited nodes are shown in black. Does not require css files, unlike the other graph visualization functions.
Example usage:
val grid = Grid(2, 2, true)
grid.visualizeGrid(
currentVisitedNodes = listOf(Tile(0, 0), Tile(1, 0), Tile(1, 1), Tile(0, 1)),
finalPath = listOf(Tile(0, 0), Tile(1, 0), Tile(1, 1)),
nodeDistances = listOf(0.0, 1.0, 2.0, 3.0),
screenTitle = "GraphMateKT visualizeGrid example usage",
animationTicTimeOverride = 1000.0,
closeOnEnd = true,
startPaused = true,
screenWidthOverride = 300.0
)Parameters
A list of tiles representing the nodes visited in order during the traversal.
A list of tiles representing the final path in the grid.
A list of distances to each visited node.
The title of the visualization window.
Overrides the default animation speed in milliseconds.
If true, closes the visualization window when the animation ends.
If true, starts the visualization in a paused state.
Overrides the default screen width for the visualization.
Throws
If the grid is improperly configured for visualization.