Optimization of Game of Life for a class