See a version of the CenterBot from Assignment 4. This version uses Approach #3 to get to the center of the battlefield.
// x=0, y=0; moves to lower left corner gotoCoords( 0, 0 ); // x=800, y=600; moves to upper right corner gotoCoords( 800, 600 );