Precipitating convection is an important component of tropical atmospheric circulation. A cloud typically persists for an hour before it is shut down by its own evaporation-driven downdraft, which generates a gust front in the mixed layer that triggers neighboring clouds. There is no systematic theory for what sets the spacing of precipitating clouds, which is the first step towards understanding cloud interaction. We propose to view precipitating convection as a piecewise linear oscillator with cutoff, which separately describes the physical processes in the convective and recovery phase, but considers the stabilizing and destabilizing effects in a holistic way. The first hypothesis is that the cloud spacing is determined by the optimal (most unstable) mode of this system. Too short a spacing does not allow the gust front moisture to recover sufficiently, and too long a spacing makes the gust front's dynamical lifting effect too weak. The second hypothesis is that the optimal mode should be neutral to convection in equilibrium. Further analysis shows that the destabilizing effect of the gust front's triggering should be balanced by the damping effect of incomplete recovery and cold pool entrainment. This leads to a theory of cloud spacing for equilibrium deep convection, which predicts an upper bound that is proportional to the inverse of the cold pool fractional entrainment rate. The theory is benchmarked against a series of large-eddy simulations. The increase and stagnancy of cloud spacing with increased rain evaporation rate are well predicted by the theory.