A simple reflex agent does an action if a condition is given to it. It does not have a wide spectra of knowledge. So we need to give the correct commands and it will perform accordingly. From the above we know that the vacuum cleaner is an example of this kind of agent. We have to feed it environment knowledge as conditions. So let us see a simple pseudo code with which you can develop the operations of the vacuum cleaner.
Pseudo code for vacuum operations:
1.Assume the position of the agent in an array form. Since there are three spaces given we set an array n holding 3 positions.
2.Declare variables for status as d for dirty and c for clean as boolean values.
3.Declare a variable to store the points value.
4.If particles are present the agent can sensor them and the space is dirty.
5.If d variable becomes true then perform the suck operation.
6.Set a count variable to see how many moves the agent makes. Set a random count value and say that the agent can make
these many counts in the specific time(20).
7.Declare the time taken should be 20 and if it takes more time than that then agent fails in completing the task.
8.Use a for loop to iterate the positions. i.e n=0 and so. If n=2 then n-1 is done to go to the previous position. If agent is in C space then (n-1) is done so that it goes to B position
9.If c variable becomes true then that means the room is clean and NoOp is done and the agent stops the task and exits the loop.
10.Finally calculate the performance of the agent by multiplying the point achieved and time which is already given i.e. 20.
1[30%]. This problem is similar to question 2.10 in the text book, except the environment configuration...