An equilibrium-based learning approach with application to robotic fish