(adj-coords-2d [x y] & {:keys [include-diagonals]})
Coordinates of adjacent points. If include-diagonals is not set or false, returns the four adjacent points (of the von Neumann neighborhood), always in the order N W S E. If include-diagonals is set to true, return the eight adjacent coordinates (of the Moore neighborhood)
Coordinates of adjacent points. If include-diagonals is not set or false, returns the four adjacent points (of the von Neumann neighborhood), always in the order N W S E. If include-diagonals is set to true, return the eight adjacent coordinates (of the Moore neighborhood)
A two-dimensional grid of values
A two-dimensional grid of values
(height this)
The total height of the grid (number of cells in the vertical direction)
The total height of the grid (number of cells in the vertical direction)
(neighbors-4 this pos)
A map of the positions and values of the four nearest (von Neumann) neighbors of position pos
A map of the positions and values of the four nearest (von Neumann) neighbors of position pos
(neighbors-8 this [x y])
A map of the positions and values of the eight nearest (Moore) neighbors, including diagonals, of position pos
A map of the positions and values of the eight nearest (Moore) neighbors, including diagonals, of position pos
(slice this dim idx)
A slice of the grid along dim (:row or :col) at index idx
A slice of the grid along dim (:row or :col) at index idx
(value this pos)
The value of the grid at position pos
The value of the grid at position pos
(width this)
The total width of the grid (number of cells in the horizontal direction)
The total width of the grid (number of cells in the horizontal direction)
(Grid2D->ascii charmap grid2d)
Convert a Grid2D into an ASCII-art string representation.
charmap is a map where the keys are ASCII chars and the values are expected to be symbols to use in your application. Ex.: (def charmap {. :space # :wall})
Convert a Grid2D into an ASCII-art string representation. charmap is a map where the keys are ASCII chars and the values are expected to be symbols to use in your application. Ex.: (def charmap {\. :space \# :wall})
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close