Optional cols: numberOptional cellSize: numberPrivate Readonly agentAgent to grid coordinate mapping
Protected agentAgent position tracking
Protected agentsAgents currently in this environment
Private Readonly configGrid configuration
Protected Readonly dimensionsEnvironment dimensions
Private Readonly grid2D grid of cells
Static prefixedCheck if cell can accommodate more agents
Find neighbors within radius (in grid cells)
Get grid coordinate for agent
Get agents in specific grid cell
Get neighbors of a grid cell
Get environment dimensions
Get empty cells in grid
Get current grid configuration
Get grid occupancy statistics
Convert grid coordinate to position (center of cell)
Private initializePrivate isCheck if grid coordinate is valid
Check if position is within environment bounds
Protected onProtected onProtected onHook: Handle agent removal
Place agent at specific grid coordinate
Convert position to grid coordinate
Remove agent from environment
Private removeRemove agent from grid
Private validate
Grid2D - Discrete grid-based 2D environment
Features:
Educational Context: Represents structured environments like seating arrangements, organizational charts, board games, or cellular automata simulations.