cis32 homework #2
sklar/spring-2006
and the questions are...
@
symbol in the figures below)
has 4 sensors (one in the front, one in the back and one on each side):
front 1 4@2 3 backIf there is a line under a sensor, the sensor returns 1; otherwise it returns 0. For example:
| @ |returns 1010. If the robot is in the middle of a crossroads, e.g.:
| -@- |the sensors return 1111.
1a. How many possible states are there? Enumerate them. For convenience in completing the next two steps, label each state (e.g., x1, x2, etc.).
1b.
revised and clarified description:
First, define the possible actions for the robot (hint: there
are only four).
For convenience in completing the next two steps, label each action
(e.g., a1, a2, etc.).
Then, define one recommended action for each state.
For example, if the robot is in this state:
| @ |then the robot could either go forward or backward; since it is doing line-following, it won't make sense for it to go left or right (oops---I've just given away all of the possible actions...). You decide whether you prefer for the robot to go forward or backward when it encounters that state; then add that to your list of recommended actions.