public void evolve() {
        boolean[][] nextCellStates = new boolean[xSize][ySize];
        for (int i = 0; i < xSize; i++) {
            for (int j = 0; j < ySize; j++) {
                //if cell is already alive, it must be surrounded by 3 live cells to stay alive
                if (this.getState(i, j)) {
                    if (this.getSurrounding(i, j) == 2) {
                        nextCellStates[i][j] = true;
                    } else {
                        nextCellStates[i][j] = false;
                    }
                }
                //if cell is dead, it must be surrounded by 2 or 3 live cells to come alive
                else if (this.getState(i, j) == false) {
                    if ((this.getSurrounding(i, j) == 2) || (this.getSurrounding(i, j) == 3)) {
                        nextCellStates[i][j] = true;
                    }
                }
            }
        }
        this.cellStates = nextCellStates;
    }