Abstract: Nature has the best design, which has evolved over millennia for sustainability. The current research aims to provide a generalized algorithm for multi-legged fault-tolerant walking robots with 3 degrees of freedom per leg. An inverse-kinematics-based model has been implemented for strategic foot placement. Animals walk over rough ground and move each leg separately, often falling in a non-standard gait. The present work allows a provision for the designed robot to move over uneven terrain in a controlled manner, using adaptive gaits while maintaining a constant hip height. One of the key features of the developed algorithm is the ability to adapt locomotion and continue functioning even if some legs are injured. An experimental study was carried out in order to validate the effectiveness and applicability of the current algorithm. As far as the present knowledge of the authors goes, there is no systematic study of developing a generalized algorithm for fault-tolerant multi-legged robots available in the open literature.