Tile

A square, of which many make up the “floor” of the model.

class agents.Tile(x, y, model)

Creates a tile. x and y is the tile’s position in the tile grid, not absolute coordinates for the model.

Parameters:
  • x – The tile’s x-coordinate in the tile grid.
  • y – The tile’s y-cooridnate in the tile grid.
  • model – The model that the tile is a part of.
add_agent(agent)

Adds an Agent to the set of agents standing on the tile. Usually called by the method Agent.update_current_tile.

Parameters:agent – The agent to add.
color

The color of the agent. Must be provided as an RGB 3-tuple, e.g. (255, 255, 255) to color the agent white.

get_agents()

Gets the set of agents currently on the tile.

remove_agent(agent)

Removes an Agent agent from the set of agents standing on the tile. Usually called by the method Agent.update_current_tile.

Parameters:agent – The agent to remove.