We propose an algorithm, inspired by intelligent property of a slimemold, for adaptive formation transitions of a robot group composing autonomous, non-labeled robots. In the proposed system, one leader robot that knows the target position guides the other robots; the other robots do not have any global information. Each individual robot is equipped with a nonlinear oscillator and a simple communication system realized by LED flashlights. In order to control these robots, we have used phase gradients and phase waves in a manner similar to that of a slime mold (amoeba). By controlling the heading directions of the followers according to the phase gradients, a swarm of robots can change its formation adaptively in an obstacle region. We have not only formulated the algorithm but also developed real hardware and analyzed the system design. We have verified the proposed system by simulations and by real implementations of 12 autonomous mobile robots.