The evolution of distributed sensing and collective computation in