Edit in JSFiddle

// Enabling this will allow manual control of the square using the arrow keys.
// The `stepController()` function will be disabled.
var enableManual = false;

// The `angle` parameter is the angle off-center of the circle and square:
//   0.0 = circle directly above square
//   -90.0 = circle completely to left of square
//   90.0 = circle completely to right of square
// The return value of this function is an acceleration applied to the square;
// positive values are to the right and negative to the left.
function stepController(angle) {
    var accel = 0.0;
    // Add your code here...
    return accel;
}