An approach to controlling autonomous mobile robots that move around in flocks is described. Our main concern is how to design an on-line behavior acquisition mechanism which is capable of developing the cooperative behavior in an embedded environment. To design a behavior-learning controller, reinforcement learning is carefully implemented. The validation of our approach is done through computer simulations.