|
|
Maze |
|
Back |
extern
void object::Maze( )
{
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 ) // nothing
in front ?
{
move(5); //
move on to the next position
continue;
}
if ( left==null ) // nothing
to the left ?
{
turn(90); //
turn left
continue;
}
if ( right==null ) // nothing
on the right ?
{
turn(-90); //
turn right
continue;
}
break;
}
} |
|