Import std.collections.grid
Grid
class
Public Class Grid<T> Implements Iterable<T>, Cloneable
A rectangle of cells, Width by Height, each a T, indexed as grid[x, y].
Examples
Local grid = Grid<Int>(3, 2, 0)
grid[2, 1] = 5
Expect(grid[2, 1] == 5 && grid[0, 0] == 0)
Expect(grid.Count == 6)
Expect(grid.InBounds(2, 1) && !grid.InBounds(3, 0))
Expect(grid.Neighbors4(0, 0) == [(1, 0), (0, 1)])std/collections/grid.fb, line 23
-
A Grid
widthcells across andheightdown, each holdingfill. A negative size panics, and so does one with more cells than an Int counts. -
How many cells wide it is.
-
How many cells high it is.
-
How many cells it has, Width times Height.
-
Whether (
x,y) is one of the Grid's cells. -
The value at (
x,y). One outside the Grid panics. -
Sets the value at (
x,y) tovalue. One outside the Grid panics. -
The positions beside (
x,y) that are in the Grid: above, left, right, and below it. -
The positions around (
x,y) that are in the Grid, its corners too, row by row. -
Gives every cell the
value. -
The values, row by row, in a new array.
-
A new Grid with the same size and values.
-
The values, row by row.
Report an issue with this page or with FutureBlitz on GitHub.