# Option vlc-playing2 the VLC-playing option (very much like the penalty player of 2004) ## State Machine ## State handleBall
If that state is active,
> | The option vlc-handle-ball is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | ball.just-seen | ) | // ball was just seen
{
if ( | abs( (ball.known-or-near.angle - angle.angle-to-point-behind-opponent-goal) ) > 150 | ) | // ball is in a direction where grabbing and turning would be better
{
transition-to-state(goAndGrab);
}
else
{
transition-to-state(handleBall);
}
}
else if ( | ball.time-since-last-seen > 4000 | ) | // ball not seen for some time
{
transition-to-state(search);
}
else
{
transition-to-state(handleBall);
}
## State goAndGrab
If that state is active,
> | The option grab-ball-with-head is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | subsequent-option-reached-target-state | ) | // ball was sucessfully grabbed
{
transition-to-state(turnAndRelease);
}
else if ( |
( | ball.just-seen | )
&& |
( | abs( (ball.known-or-near.angle - angle.angle-to-point-behind-opponent-goal) ) < 120 | )
| ) | // ball was just seen and lies in a quite good direction to thegoal
{
transition-to-state(handleBall);
}
else if ( | ball.time-since-last-seen > 4000 | ) | // ball not seen for some time
{
transition-to-state(search);
}
else
{
transition-to-state(goAndGrab);
}
## State turnAndRelease
If that state is active,
> | The option vlc-turn-and-release is executed. Parameters:
| vlc-turn-and-release.angle | = | angle.angle-to-center-of-opponent-penalty-area ;
The decision tree:
Pseudo code of the decision tree:
if ( | subsequent-option-reached-target-state | ) | // ball was turned or lost
{
transition-to-state(handleBall);
}
else
{
transition-to-state(turnAndRelease);
}
## State search
If that state is active,
> | The option vlc-search-for-ball is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | ball.just-seen | ) | // ball was just seen
{
transition-to-state(handleBall);
}
else if ( |
( | time-of-state-execution > 6000 | )
&& |
( | save-value( 123 , (-1600 + (random * 3200)) ) == 0 | )
| ) | // ball wasn't seen for a very long time (use the save/get hack to fix a random number for the positioning
{
transition-to-state(confusedRepositioning);
}
else
{
transition-to-state(search);
}
## State confusedRepositioning
If that state is active,
> | The option get-to-position-and-avoid-obstacles is executed. Parameters:
| get-to-position-and-avoid-obstacles.x | = | 500 ;
| get-to-position-and-avoid-obstacles.y | = | get-value( 123 ) ;
| get-to-position-and-avoid-obstacles.destination-angle | = | 0 ;
| get-to-position-and-avoid-obstacles.max-speed | = | 450 ;
| get-to-position-and-avoid-obstacles.no-obstacle-avoidance-distance | = | 700 ;
| get-to-position-and-avoid-obstacles.avoid-penalty-areas | = | 0 ;
| get-to-position-and-avoid-obstacles.avoidance-level | = | 1 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-auto
The decision tree:
Pseudo code of the decision tree:
if ( | ball.just-seen | ) | // ball was seen
{
transition-to-state(handleBall);
}
else if ( | distance-to( 500 , get-value( 123 ) ) < 400 | ) | // reached the target position
{
transition-to-state(search);
}
else
{
transition-to-state(confusedRepositioning);
}