Analytical solution of a one-dimensional Ising model with zero-temperature dynamics