Академический Документы
Профессиональный Документы
Культура Документы
Actions:
change_direction
move_one_step
suck
In(x,y) agent is at (x,y)
Dirt(x,y) there is a dirt at (x,y)
y=i;
move_one_step (X,Y+1)
if ( in(x,y) are some thing prevent the agent from go on ) then
{
change_direction (x+1, y)
move_one_step (X,Y+1)
then return to the specific road by :
change_direction (x-1, y)
move_one_step (X,Y+1)
if ( dirt (x,y) )
{
suck(x,y)
}
Else Continue moving
In(x,y) " is the current agent position at the end of the room , so know the agent
have to change its direction to the left by 1 position
move_one_step (X+1,Y)
know the agent will rescan the room vertically and performing the same steps
but in descending order and as follows :
y=i;
move_one_step (X,Y-1)
if ( in(x,y) are something prevent the agent from go on ) then
{
change_direction (x+1, y)
move_one_step (X,Y-1)
then return to the specific road by :
change_direction (x-1, y)
move_one_step (X,Y-1)
if ( dirt (x,y) )
{
suck(x,y)
}
Else Continue moving
After iterate the above two steps according to the room length and width the room will
be cleaned perfectly by the movement of the agent , and the first goal has been
achieved
x=i;
move_one_step (X+1,Y)
if ( in(x,y) are something prevent the agent from go on ) then
{
change_direction (x, y+1)
move_one_step (X+1,Y)
then return to the specific road by :
change_direction (x, y-1)
move_one_step (X+1,Y)
if ( dirt (x,y) )
{
suck(x,y)
}
Else Continue
In(x,y) " is the current agent position at the end corner , so know the agent have to
change its direction to the down by 1 position
move_one_step (X,Y-1 )
and moving in reverse order trying to reach the other position of the room , so initially
we will perform the following steps :
For ( I = width of the room ; i<=1 ; i- - )
x= i;
move_one_step (X-1,Y)
if ( in(x,y) are something prevent the agent from go on ) then
{
change_direction (x, y+1)
move_one_step (X-1,Y)
then return to the specific road by :
change_direction (x, y-1)
move_one_step (X-1,Y) }
if ( dirt (x,y ) )
{
suck(x,y)
}
Else Continue
4
The second room has been cleaned to , the second goal have been achieved .
The cleaning of the other rooms will follow the same methods for cleaning the rooms
The same steps , moving from the start of each room, . perform vertically or
horizontally scan then clean every position that you find any dirt in it .
This type of agent follow the sequential way in scanning . scan every place and postion
in the rooms to cleaning
And adaptation to the agent is to add predictability . predicating the place of
dirt . and go for it . this will minimize the massive scan time and speed up the cleaning
process and time required by it .