# Option playing-striker The striker playing ## State Machine ## State ball-not-known-for-long
This state is a target state.
If that state is active,
> | The option search-for-ball is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | strategy.ball-is-handled-at-the-moment | ) | // ball is handled
{
transition-to-state(handle-ball);
}
else if ( | ball.time-since-last-known > 12000 | ) | // ball not known for long
{
transition-to-state(ball-not-known-for-long);
}
else
{
transition-to-state(handle-ball);
}

## State handle-ball

This state is a target state.
If that state is active,
> | The option handle-ball is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | strategy.ball-is-handled-at-the-moment | ) | // ball is handled
{
transition-to-state(handle-ball);
}
else if ( | ball.time-since-last-known > 12000 | ) | // ball not known for long
{
transition-to-state(ball-not-known-for-long);
}
else
{
if ( | strategy.ball-is-handled-at-the-moment | ) | // ball is handled
{
transition-to-state(handle-ball);
}
else if ( |
( | ball.time-since-last-seen < 500 | )
&& |
( | ball.seen.distance-to-own-penalty-area < 20 | )
| ) | // ball seen in own penalty area
{
transition-to-state(ball-in-own-penalty-area);
}
else if ( |
( | ball.time-since-last-known < 1000 | )
&& |
( | ball.seen.distance > ball-not-near-distance | )
&& |
( | obstacles.close | )
| ) | // not near the ball
{
transition-to-state(get-to-ball);
}
else
{
transition-to-state(handle-ball);
}
}

## State get-to-ball

This state is a target state.
If that state is active,
> | The option get-to-ball-and-avoid-obstacles is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | strategy.ball-is-handled-at-the-moment | ) | // ball is handled
{
transition-to-state(handle-ball);
}
else if ( | ball.time-since-last-known > 12000 | ) | // ball not known for long
{
transition-to-state(ball-not-known-for-long);
}
else
{
if ( |
( | ball.time-since-last-seen < 500 | )
&& |
( | ball.seen.distance-to-own-penalty-area < 20 | )
&& |
( | robot-pose.validity > 0.4 | )
| ) | // ball seen in own penalty area and well localized
{
transition-to-state(ball-in-own-penalty-area);
}
else if ( |
( | ball.time-since-last-seen < 1000 | )
&& |
( | ball.seen.distance < ball-near-distance | )
| ) | // near the ball
{
transition-to-state(handle-ball);
}
else
{
transition-to-state(get-to-ball);
}
}

## State ball-in-own-penalty-area

This state is a target state.
If that state is active,
> | The option position-striker-when-ball-in-own-penalty-area is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | strategy.ball-is-handled-at-the-moment | ) | // ball is handled
{
transition-to-state(handle-ball);
}
else if ( | ball.time-since-last-known > 12000 | ) | // ball not known for long
{
transition-to-state(ball-not-known-for-long);
}
else
{
if ( |
( | ball.time-since-last-seen < 1000 | )
&& |
( | ball.seen.distance-to-own-penalty-area > 70 | )
| ) | // ball seen outside own penalty area
{
transition-to-state(handle-ball);
}
else
{
transition-to-state(ball-in-own-penalty-area);
}
}