Skip to content

Commit

Permalink
space: Update (Hex)MultiGrid with correct empties docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
EwoutH authored and rht committed Nov 28, 2023
1 parent 6dd7ede commit 0ae1c8c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions mesa/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,14 @@ class MultiGrid(_Grid):
bottom-left and [width-1, height-1] is the top-right. If a grid is
toroidal, the top and bottom, and left and right, edges wrap to each other.
Unlike SingleGrid, MultiGrid does not inherently track empty cells due to
the possibility of multiple agents occupying a single cell.
This class maintains an `empties` property, which is a set of coordinates
for all cells that currently contain no agents. This property is updated
automatically as agents are added to or removed from the grid.
Properties:
width, height: The grid's width and height.
torus: Boolean which determines whether to treat the grid as a torus.
empties: Returns a set of (x, y) tuples for all empty cells.
"""

grid: list[list[MultiGridContent]]
Expand Down Expand Up @@ -774,12 +776,15 @@ class HexMultiGrid(_HexGrid, MultiGrid):
Functions according to odd-q rules.
See http://www.redblobgames.com/grids/hexagons/#coordinates for more.
Similar to the standard MultiGrid, this grid does not automatically track
empty cells due to the possibility of multiple agents in one cell.
Similar to the standard MultiGrid, this class maintains an `empties` property,
which is a set of coordinates for all hexagonal cells that currently contain
no agents. This property is updated automatically as agents are added to or
removed from the grid.
Properties:
width, height: The grid's width and height.
torus: Boolean which determines whether to treat the grid as a torus.
empties: Returns a set of hexagonal coordinates for all empty cells.
"""


Expand Down

0 comments on commit 0ae1c8c

Please sign in to comment.