3      !"#$%&'()*+,-./012portable experimentalamy@nualeargais.ie Safe-Inferred"0A parallelogramatical grid with hexagonal tiles G The grid and its indexing scheme are illustrated in the user guide,  available at  %https://github.com/mhwombat/grid/wiki. &A hexagonal grid with hexagonal tiles G The grid and its indexing scheme are illustrated in the user guide,  available at  %https://github.com/mhwombat/grid/wiki. #A toroidal grid with square tiles. G The grid and its indexing scheme are illustrated in the user guide,  available at  %https://github.com/mhwombat/grid/wiki. &A rectangular grid with square tiles. G The grid and its indexing scheme are illustrated in the user guide,  available at  %https://github.com/mhwombat/grid/wiki. 3A Parallelogrammatical grid with triangular tiles. G The grid and its indexing scheme are illustrated in the user guide,  available at  %https://github.com/mhwombat/grid/wiki. )A triangular grid with triangular tiles. G The grid and its indexing scheme are illustrated in the user guide,  available at  %https://github.com/mhwombat/grid/wiki. -A regular arrangement of tiles with an edge.  Minimal complete definition: boundary. CReturns a the indices of all the tiles at the boundary of a grid,  including corner tiles.  g x' returns True if the tile with index x is  on a boundary of g, False# otherwise. (Corner tiles are also  boundary tiles.) BReturns the index of the tile(s) that require the maximum number E of moves to reach the nearest boundary tile. A grid may have more A than one central tile (e.g., a rectangular grid with an even = number of rows and columns will have four central tiles).   g x' returns True if the tile with index x is  a centre tile of g, False otherwise.  A regular arrangement of tiles.  Minimal complete definition: indices, distance and size. ,Returns the indices of all tiles in a grid.   g a b. returns the minimum number of moves required ! to get from the tile at index a to the tile at index b in  grid g9, moving between adjacent tiles at each step. (Two tiles + are adjacent if they share an edge.) If a or b are not  contained within g, the result is undefined.  g bs a& returns the minimum number of moves 4 required to get from any of the tiles at indices bs to the tile  at index a in grid g(, moving between adjacent tiles at each < step. (Two tiles are adjacent if they share an edge.) If a or  any of bs are not contained within g, the result is  undefined. %Returns the dimensions of the grid.  For example, if g is a 4x3 rectangular grid,  g would  return (4, 3), while  g would return 12.  g x. returns the indices of the tiles in the grid  g+ which are adjacent to the tile with index x.  g x) returns the number of tiles in the grid  g+ which are adjacent to the tile with index x. g  `'contains'` x returns True if the index x is contained  within the grid g, otherwise it returns false.  g x/ returns a list of pairs associating the index  of each tile in g* with its distance to the tile with index x.  If x is not contained within g, the result is undefined. 4Returns the number of tiles in a grid. Compare with . Returns True+ if the number of tiles in a grid is zero, False  otherwise. Returns False+ if the number of tiles in a grid is zero, True  otherwise. BA list of all edges in a grid, where the edges are represented by ( a pair of indices of adjacent tiles.  g a b returns True if the tile at index a is ! adjacent to the tile at index b in g. (Two tiles are adjacent  if they share an edge.) If a or b are not contained within  g, the result is undefined.  g a b" returns the indices of all tiles - which are neighbours of the tile at index a, and which are  closer to the tile at b than a is. In other words, it returns 2 the possible next steps on a minimal path from a to b. If a  or b are not contained within g, or if there is no path from  a to b7 (e.g., a disconnected grid), the result is undefined.  g a b+ returns a list of all minimal paths from  the tile at index a to the tile at index b in grid g. A B path is a sequence of tiles where each tile in the sequence is A adjacent to the previous one. (Two tiles are adjacent if they  share an edge.) If a or b are not contained within g, the  result is undefined. 7Tip: The default implementation of this function calls  ). If you want to use a custom algorithm,  consider modifying  instead of  . 3DFor triangular tiles, it is convenient to define a third component  z.  s* returns a triangular grid with sides of  length s, using triangular tiles. If s is nonnegative, the  resulting grid will have s^2& tiles. Otherwise, the resulting grid 7 will be empty and the list of indices will be null.  r c# returns a grid in the shape of a  parallelogram with r rows and c columns, using triangular  tiles. If r and c/ are both nonnegative, the resulting grid will  have 2*r*c8 tiles. Otherwise, the resulting grid will be empty and % the list of indices will be null.  r c" produces a rectangular grid with r rows  and c! columns, using square tiles. If r and c are both - nonnegative, the resulting grid will have r*c tiles. Otherwise, E the resulting grid will be empty and the list of indices will be  null.  r c returns a toroidal grid with r  rows and c! columns, using square tiles. If r and c are 2 both nonnegative, the resulting grid will have r*c tiles. Otherwise, J the resulting grid will be empty and the list of indices will be null.  s) returns a grid of hexagonal shape, with  sides of length s, using hexagonal tiles. If s is nonnegative, the  resulting grid will have  3*s*(s-1) + 1" tiles. Otherwise, the resulting < grid will be empty and the list of indices will be null.   r c# returns a grid in the shape of a  parallelogram with r rows and c% columns, using hexagonal tiles. If  r and c4 are both nonnegative, the resulting grid will have r*c tiles. M Otherwise, the resulting grid will be empty and the list of indices will  be null. E456789 :;3<=>?@ABCDE FGHIJKLMNOPQRSTUV!  !   ,456789  :;3<=>?@ABCDE FGHIJKLMNOPQRSTUVportable experimentalamy@nualeargais.ie Safe-Inferred!  !   portable experimentalamy@nualeargais.ie Safe-Inferred!0A Map from tile positions in a grid to values. "GConstruct a grid map which is strict in the keys (tile positions), but  lazy in the values. # O(min(n,W))1. Find the value at a tile position in the grid.  Calls W$ when the element can not be found. $ O(min(n,W))7. Lookup the value at a tile position in the grid map. % O(min(n,W))<. Adjust a value at a specific tile position. When the tile D is not within the bounds of the grid map, the original grid map is  returned. & O(min(n,W))2. Adjust a value at a specific key. When the tile D is not within the bounds of the grid map, the original grid map is  returned. ' O(min(n,W)). The expression (' def k map) $ returns the value at tile position k or returns def when the tile + is not within the bounds of the grid map. (O(n)2. Map a function over all values in the grid map. )O(n)2. Map a function over all values in the grid map. *O(n). The function * threads an accumulating  argument through the grid map. K WARNING: The order in which the elements are processed is not guaranteed. +O(n). The function + threads an accumulating  argument through the grid map. K WARNING: The order in which the elements are processed is not guaranteed. ,O(n)C. Fold the values in the grid map using the given left-associative  binary operator. K WARNING: The order in which the elements are processed is not guaranteed. -O(n)<. Fold the keys and values in the grid map using the given # left-associative binary operator. K WARNING: The order in which the elements are processed is not guaranteed. .O(n). A strict version of ,. /O(n). A strict version of -. 0O(n). C Return all elements of the grid map. The order is not guaranteed. 1 O(n*min(n,W))1. The set of all tile positions in the grid map. 2O(n)!. Returns all key (tile position)/value pairs in the grid map. !XYZ"#[\$%&'()*+,-./012]^ !"#$%&'()*+,-./012!" #$'%&()*+,-./012!XYZ"#[\$%&'()*+,-./012]^_      !"#$%&'()*+,-./01234567 89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_grid-3.0Math.Geometry.GridInternalMath.Geometry.GridMapMath.Geometry.Grid ParaHexGrid HexHexGrid TorSquareGridRectSquareGrid ParaTriGrid TriTriGrid BoundedGridboundary isBoundarycentreisCentreGridindicesdistance minDistancesize neighbours numNeighbourscontains viewpoint tileCountemptynonEmptyedges isAdjacentadjacentTilesToward minimalPaths triTriGrid paraTriGridrectSquareGrid torSquareGrid hexHexGrid paraHexGridGridMap lazyGridMap!lookupadjust adjustWithKeyfindWithDefaultmap mapWithKeymapAccummapAccumWithKeyfold foldWithKeyfold' foldWithKey'elemskeysSettoListtriZsameEdge adjacentEdges triDistance triNeighbours inTriGridtrefoilWithTopparaTriGridCentrebowtiecartesianIndicescartesianCentre midpoints hexDistance$fBoundedGridParaHexGrid(,)(,)$fGridParaHexGrid(,)(,)$fShowParaHexGrid$fBoundedGridHexHexGridInt(,)$fGridHexHexGridInt(,)$fShowHexHexGrid$fGridTorSquareGrid(,)(,)$fShowTorSquareGrid!$fBoundedGridRectSquareGrid(,)(,)$fGridRectSquareGrid(,)(,)$fShowRectSquareGrid$fBoundedGridParaTriGrid(,)(,)$fGridParaTriGrid(,)(,)$fShowParaTriGrid$fBoundedGridTriTriGridInt(,)$fGridTriTriGridInt(,)$fShowTriTriGridbaseGHC.ErrerrorLGridMaptoGridtoMap modifyMap applyToMap$fGridGridMapsk $fShowGridMap