My hardest one was teaching a biped robot to walk!
It was a competition where biped robots had to do different tasks. I've used Genetic Algorithm and Artificial Neural Networks to train the robot in simulation environment with physics engine first. After it was kind of working, started testing the same code on the real robot. After a week of training it could walk really slowly without falling.
The hardest piece was avoiding the obstacles which took a while to implement.