lib/game_of_life/board.rb
def shed_dead_weight!
      # Remove the first and last rows if all cells are dead
      @cells.shift if @cells.first.all? { |cell| cell.dead? }
      @cells.pop if @cells.last.all? { |cell| cell.dead? }

      # Remove the first cell of every row, if they are all dead
      first_columns = @cells.map { |row| row.first }
      if first_columns.all? { |cell| cell.dead? }
        @cells.each { |row| row.shift }
      end

      # Remove the last cell of every row, if they are all dead
      last_columns = @cells.map { |row| row.last }
      if last_columns.all? { |cell| cell.dead? }
        @cells.each { |row| row.pop }
      end

      validate
    end
def shed_dead_weight!
      # Remove the first and last rows if all cells are dead
      @cells.shift if @cells.first.all? { |cell| cell.dead? }
      @cells.pop if @cells.last.all? { |cell| cell.dead? }

      # Remove the first cell of every row, if they are all dead
      first_columns = @cells.map { |row| row.first }
      if first_columns.all? { |cell| cell.dead? }
        @cells.each { |row| row.shift }
      end

      # Remove the last cell of every row, if they are all dead
      last_columns = @cells.map { |row| row.last }
      if last_columns.all? { |cell| cell.dead? }
        @cells.each { |row| row.pop }
      end

      validate
    end
This is the third and last stage in a Game's #tick.
 @see Game#tick