The world is filled with systems of entities that collaborate in motion, both natural and engineered, that are capable of sophisticated emergent behavior arising from simple interactions of their members. This PhD dissertation collects my work on the amoebot model, stateful and stochastic distributed algorithms for programmable matter, and translations to active granular matter.