Among the different types of robots, modular and self-reconfigurable robots such as SuperBot have less limitations than their counterparts due to their versatility of gaits and increased dynamic adaptability. This results in a highly dexterous and adjustable robot suitable for many environments. This however, usually comes at the expense of a necessary human observer required to monitor and control the robot manually resulting in a waste of power and time. Thus, an intelligent system would be indispensable in optimzing the behavior and control of modular and self-reconfigurable robots. This paper presents an Intelligent Online Reconfiguration System (IORS) which through a combination of learning and reasoning, increases the efficiency in control and movement of the modular and self-reconfigurable robot called Superbot. Using this system, Superbot is able to learn and choose the best gait automatically by sensing its current environment (e.g., friction or slope). As a result, the IORS implementation in SuperBot achieves: 1) correct slope gradient sensing, 2) best gait learning to traverse different slopes, and 3) rational decision making for choosing the best gait.