Due date: Thursday, April 3, 2008.
Ex. 1 Download the following Python program implementing a
simple expert system:
car_expert.py
This implements the expert system discussed in class and illustrated
in the following figure:
a. Add a function that reads the database from a file. The function should take a filename as a parameter. We'll assume that every state is a single word followed by the question to be asked when that state is reached on one line and by the states to move to in case of positive and negative answers on a line together. If the state is terminal, then we'll have an empty line in place of the line containing these two states.
The file car_db.txt contains an example of such a file for the database in the figure above.
b. Note that the expert system is not completely defined because one non-terminal state corresponding to the question "Do you want a fast car?" doesn't lead to any other state.
Add at leat 10 more nodes to the tree and update the database text file accordingly (you don't have to modify the hard coded function). Make sure that any non-terminal state has two children for the two possible answers.
Turn in: the modified program by email along with the text file containing the database and the updated tree in any form.