Reference 〉 Class

Patches2D( tuple(int, int) dim, list[function(Patch)] props = [], list[function(Agent)] funcs = [] )

A list-like class (list of lists) that provides for retrieving patches by [x,y] index. This is not a full coordinate system, and should be subclassed by a full coordinate system.

WARNING: This is an internal class. Its use in user code is not recommended or supported, and its signature can change in future updates without warning. Use one of the suggested functions above instead, if applicable.

Initialization Parameters

  • dim tuple(int, int), required

    The dimensions of the grid.

  • props list[function(Patch)], optional

    A list of functions to be assigned to patches as properties by subclasses. For example PatchesRect defines Patch.up, Patch.down, Patch.left, and Patch.right, whereas PatchesPolar defines Patch.inward, Patch.outward, Patch.clockwise, and Patch.counterclockwise.

    Default value: []

  • funcs list[function(Agent)], optional

    A list of functions to be assigned to non-patch agents by subclasses. For example, subclasses should define Agent.orientTo() and Agent.distanceFrom() based on the coordinate system.

    Default value: []

Static Properties

  • geometry str

    The name of the patch geometry, to be set by subclasses.

    Initial value: ''

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.

History