Documentation ¶
Index ¶
- Variables
- func Print[T rune | byte](g Grid[T])
- func PrintFunc[T any](g Grid[T], f func(T) rune)
- type Grid
- func (g Grid[T]) Cells() []T
- func (g Grid[T]) Fill(t T)
- func (g Grid[T]) FilterValid(idxs []Index) []Index
- func (g Grid[T]) Get(i Index) T
- func (g Grid[T]) IndexedCells() []IndexedCell[T]
- func (g Grid[T]) IndexedCellsByColumn() []IndexedCell[T]
- func (g Grid[T]) Indexes() []Index
- func (g Grid[T]) LenCols() int
- func (g Grid[T]) Lookup(i Index) (T, bool)
- func (g Grid[T]) Set(i Index, t T)
- func (g Grid[T]) Transpose() Grid[T]
- type Index
- type IndexedCell
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Up = Index{0, -1} Down = Index{0, 1} Left = Index{-1, 0} Right = Index{1, 0} )
Functions ¶
Types ¶
type Grid ¶
type Grid[T any] [][]T
func FromGridSize ¶
func NewGridSize ¶
func (Grid[T]) FilterValid ¶
func (Grid[T]) Get ¶
Get returns the value at i if i is within the bounds of the grid, otherwise the zero value for T. To test if i is valid use Lookup instead.
func (Grid[T]) IndexedCells ¶
func (g Grid[T]) IndexedCells() []IndexedCell[T]
Cells of the grid in row-major order.
func (Grid[T]) IndexedCellsByColumn ¶
func (g Grid[T]) IndexedCellsByColumn() []IndexedCell[T]
Cells of the grid in column-major order.
type IndexedCell ¶
Click to show internal directories.
Click to hide internal directories.