 |
 |
Labyrinth |
 |
Zurück |
extern
void object::Labyrinth( )
{
while ( true )
{
object front, left, right;
front = radar(Barrier, 0,
45, 0, 5);
left = radar(Barrier, 90,
45, 0, 5);
right = radar(Barrier, -90,
45, 0, 5);
if ( front == null ) //
vorne frei?
{
move(5); //
vorwärts zum nächsten Feld
continue;
}
if ( left == null ) //
links frei?
{
turn(90); //
Drehung links
continue;
}
if ( right == null ) //
rechts frei?
{
turn(-90); //
Drehung rechts
continue;
}
break;
}
} |
|