Intelligent Shape-Morphing Micromachines