This document proposes using truncated Fourier series and gravitational search algorithm to generate walking and turning motions for a biped robot locomotion. It discusses using truncated Fourier series to model joint angle trajectories from recorded human gaits. The gravitational search algorithm is then used to optimize the Fourier parameters to improve the robot's walk. Simulation results on the NAO robot show it can walk and turn without falling when no external forces are applied.