Computation of mutual fitness by competing bacteria