Often in a defensive position, it is advantageous to just send the ball upfield, clearing it from the defensive zone. If the agent decides that it cannot pass or dribble while in a defensive situation, it will clear the ball. The important decision in clearing the ball is where to clear it to. The best clears are upfield, but not to the middle of the field (you don't want to center the ball for the opponents), and also away from the opponents.

The actual calculation is as follows. Every angle is evaluated with respect to its usefulness, and the expected degree of success. The usefulness is a sine curve with a maximum of 1 at 30 degrees, .5 at 90 degrees, and 0 at -90, where a negative angle is towards the middle of the field. The actual equation is ( is in degrees):

The expected degree of success is evaluated by looking at an isosceles
triangle with one vertex where the ball is, and congruent sides
extending in the direction of the target being evaluated. For each
opponent in the triangle, its distance from the center line of the
triangle is divided by the distance from the player on that line. For
opponent C in Figure 7, these values are *w* and *d*
respectively. The expected success is the product of all these
quotients. In Figure 7, opponent A would not affect the
calculation, being outside the triangle, while opponent B would lower
the expected success to 0, since it is on the potential clear line (*w
= 0*).

**Figure 7:** Measuring the expected success of a clear.

By multiplying the usefulness and expected success together for each possible clear angle, and taking the maximum, the agent gets a crude approximation to maximizing the expected utility of a clear.

There is a closely related behavior of offensive ``sending.'' Rather than trying to clear the ball to the sides, the agent sends the ball to the middle of the offensive zone with hopes that a teammate will catch up to the ball before the defenders. This is useful if the agent is too tired or unable to dribble for some reason. It is especially useful to beat an offsides trap because it generally requires the defenders to run back to get the ball.

The only difference with defensive clearing is the usefulness function. For sending, the usefulness function is linear, with slope determined by the agent's Y position on the field. The closer the agent is to the sideline, the steeper the slope, and the more that it favors sending to the middle of the field.

Mon Nov 30 20:08:29 EST 1998