Performance Optimization
Example: storing neighbors
- neighbors[0] = getCellAt(x + 1, y);
- neighbors[1] = getCellAt(x - 1, y);
- neighbors[2] = getCellAt(x, y + 1);
- neighbors[3] = getCellAt(x, y - 1);
- neighbors[0] = getCellAt(x + 1);
- neighbors[1] = getCellAt(x - 1);