You are on page 1of 2

Homework 3 (Chapter 7 & 8)

1. Fires are classified according to the principal burning material. Traslate the following
information to rules for determining fire class:

Type A fires involve ordinary combustibles such as paper, wood, and


cloth.

Type B fires involve flammable and combustible liquids (such as oil


and gas), greases, and similar materials

Type C fires involve energized electrical equipment such as


computers, TV sets, and fans.

Type D fires involve ordinary combustible metals such as magnesium,


sodium, and potassium.
 
The type of extinguisher that should be used on a fire depends on the fire class. Translate the
following information to rules:
 
Class A fires should be extinguished with heat-absorbing or
combustion-retarding extinguishers such as water or water-based
liquids and dry chemicals.

Class B fires should be extinguished by excluding air, inhibiting


the release of combustible vapors, or interrupting the combustion
chain reaction. Extinguishers include dry chemicals, carbon dioxide,
foam, and bromotrifluoromethane.

Class C fires should be extinguished with nonconducting agent to


prevent short circuits. If possible the power should be cut.
Extinguishers include dry chemicals, carbon dioxide, and
bromotrifluoromethane.

Class D fires should be extinguished with smothering and heat-


absorbing chemicals that do not react with the burning metals. Such
chemicals include trimethoxyboroxine and screened graphitized coke.
 
Define two deftemplates for the burning materials and fire classes used in the above rules.
The input to the program should be made by asserting the type of buring material as a fact.
The output should be printouts indicating which extinguishers should be used and other
actions that need to be taken, such as cutting off the power.

Run the program and print out the results to show that your program works for one
material from each of the fire classes.

(Of course, you need to hand in a printout of your program!)


2. The following deftemplate is used to store information about the name, eye color, hair color,
and nationality of a person from a group of people:

(deftemplate person (slot name)


(slot eye-color)
(slot hair-color)
(slot nationality))

It is necessary to identify all the people with certain features. Write separate rules to identify
the following groups of people:

a) Anyone with blue or green eyes who has brown hair and is from France.
b) Anyone who does not have blue eyes or black hair and does not have the same color hair
and eyes.
c) Two people, the first having brown or blue eyes, not having blond hair, and a German
nationality; the second having green eyes, the same hair color as the first person, and any
noationality. The second person’s eyes may be brown if the first person’s hair is brown.

The rules should print out a message for each person found, e.g:

“Jennifer Smith fits the description for group a)”

Test your program with at least two facts for each group (the facts should fit the description
of the group). You can define the facts using deffacts construct. E.g: the following deffact
fits the description for group a):

(deffacts people “Some people I know”


(person (name “Jennifer Smith”)
(eye-color blue)
(hair-color brown)
(nationality France)))

Run your program and print out the result. You also need to hand in a printout of
your program.

You might also like