Programmable Soft Micromachines With Morphological Computation For Adaptive Locomotion