Assume that you are driving a vehicle in a 10x10 grid-like city and want to generate a plan to get from your present position to a goal position. The grid-city consists of streets and avenues . Streets run east-west and are denoted by numbers from 0 to 9 (0 being the southmost street and 9 being the northmost street). Avenues run north-south and are denoted by letters from A to J (A being the westmost avenue and J being the eastmost avenue). A position (x y) in this grid is the intersection of a street x and an avenue y. Since each segment of a street/avenue can be potentially traversed in two directions, for convenience we sometimes refer to a one-block segment of a street/avenue together with a direction simply as a dblock and use a triple (x y d), where x: street, y: avenue, d= s (south), n (north), e (east), or w (west), to denote it.. We'll say that a dblock is closed if it is (temporarily or permanently) closed to the traffic, and open otherwise.
Examples of dblocks are given below.
A B C D E F G H I J 9 -- -- -- -- -- -- -- -- -- | | | | | | | | | | 8 -- -- -- -- -- -- -- -- -- | | | | | | | | | | 7 -- -- <= => -- -- -- -- -- =>: (7 D e) | | | | | | | | | | <=: (7 D w) 6 -- -- -- -- -- -- -- -- -- | | | | | | | | | | 5 -- -- -- -- -- -- -- -- -- | | | | | | | | ^ | ^: (4 I n) 4 -- -- -- -- -- -- -- -- -- | | | | | | | | v | v: (4 I s) 3 -- -- -- -- -- -- -- -- -- | | | | | | | | | | 2 -- -- -- -- -- -- -- -- -- | | | | | | | | | | 1 -- -- -- -- -- -- -- -- -- | | | | | | | | | | 0 -- -- -- -- -- -- -- -- -- Note that (3 B e) and (3 C w) are two different dblocks which denote the same one-block segment but traversed in opposite directions.Given an initial position, e.g. (3 E), and a goal position, e.g.(7 B), your program should output a valid plan to get from the initial to the goal position, or an error message if no such plan exists. A plan
x_{i+1) = x_i + delta_x and y_{i+1) = y_i + delta_y, where | (1 0), if d = n (delta_x delta_y) = | (0 1), if d = e | (-1 0), if d = s | (0 -1), if d = wfor example, (3 B e) leads to position (3 C).
IF preconditions THEN action ; postconditionsthat captures the knowledge needed to generate valid motion plans.