Self-assembly and self-repair of arbitrary shapes by a swarm of reactive robots: algorithms and simulations