update clips

update clips

;;************************
;;* BEER KNOWLEDGE RULES *
;;************************

; determine best beer attributes for user type and scenario recognized

(defrule determine-best-beer-attributes-if-preferred-carbonation-is-any
   (declare (salience ?*medium-low-priority*))
   (preferred-carbonation ?carbonation)
   =>
   (assert (attribute (name best-carbonation) (value ?carbonation) (certainty 20))))

(defrule determine-best-beer-attributes-if-regular-beer-drinker-is-no
   (declare (salience ?*medium-low-priority*))
   (regular-beer-drinker no)
   =>
   (assert (attribute (name best-name) (value "American Cream Ale") (certainty 20)))
   (assert (attribute (name best-name) (value "Blonde Ale") (certainty 20)))
   (assert (attribute (name best-name) (value "German-Style Helles") (certainty 20)))
   (assert (attribute (name best-name) (value "German-Style Kölsch") (certainty 20)))
   (assert (attribute (name best-name) (value "Belgian-Style Witbier") (certainty 10)))
   (assert (attribute (name best-name) (value "American Amber Ale") (certainty 10)))
   (assert (attribute (name best-name) (value "Irish-Style Red") (certainty 10)))
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 10)))
   (assert (attribute (name best-name) (value "English-Style Brown Porter") (certainty 10))))

(defrule determine-best-beer-attributes-if-preferred-color-is-any
   (declare (salience ?*medium-low-priority*))
   (preferred-color ?color)
   =>
   (assert (attribute (name best-color) (value ?color) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-fermentation-is-any
   (declare (salience ?*medium-low-priority*))
   (preferred-fermentation ?fermentation)
   =>
   (assert (attribute (name best-fermentation) (value ?fermentation) (certainty 20))))

(defrule determine-best-beer-attributes-if-fermented-foods-eater-is-yes
   (declare (salience ?*medium-low-priority*))
   (fermented-foods-eater yes)
   =>
   (assert (attribute (name best-fermentation) (value wild) (certainty 20))))

(defrule determine-best-beer-attributes-if-driver-is-yes
   (declare (salience ?*medium-low-priority*))
   (driver yes)
   =>
   (assert (attribute (name best-alcohol) (value not-detectable) (certainty 20)))
   (assert (attribute (name best-alcohol) (value mild) (certainty 10))))

(defrule determine-best-beer-attributes-if-preferred-alcohol-is-low
   (declare (salience ?*medium-low-priority*))
   (preferred-alcohol low)
   =>
   (assert (attribute (name best-alcohol) (value not-detectable) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-alcohol-is-mild
   (declare (salience ?*medium-low-priority*))
   (preferred-alcohol mild)
   =>
   (assert (attribute (name best-alcohol) (value mild) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-alcohol-is-high
   (declare (salience ?*medium-low-priority*))
   (preferred-alcohol high)
   =>
   (assert (attribute (name best-alcohol) (value noticeable) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-alcohol-is-very-high
   (declare (salience ?*medium-low-priority*))
   (preferred-alcohol "very high")
   =>
   (assert (attribute (name best-alcohol) (value harsh) (certainty 20))))

(defrule determine-best-beer-attributes-if-which-cigar-is-claro
   (declare (salience ?*medium-low-priority*))
   (which-cigar claro)
   =>
   (assert (attribute (name best-style) (value "Wheat Beer") (certainty 20))))

(defrule determine-best-beer-attributes-if-which-cigar-is-maduro
   (declare (salience ?*medium-low-priority*))
   (which-cigar maduro)
   =>
   (assert (attribute (name best-style) (value "Stout") (certainty 20)))
   (assert (attribute (name best-style) (value "India Pale Ale") (certainty 20))))

(defrule determine-best-beer-attributes-if-which-cigar-is-oscuro
   (declare (salience ?*medium-low-priority*))
   (which-cigar oscuro)
   =>
   (assert (attribute (name best-style) (value "India Pale Ale") (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-flavor-is-clean
   (declare (salience ?*medium-low-priority*))
   (preferred-flavor clean)
   =>
   (assert (attribute (name best-flavor) (value crisp-clean) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-flavor-is-sweet
   (declare (salience ?*medium-low-priority*))
   (preferred-flavor sweet)
   =>
   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-flavor-is-roasty
   (declare (salience ?*medium-low-priority*))
   (preferred-flavor roasty)
   =>
   (assert (attribute (name best-flavor) (value dark-roasty) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-flavor-is-bitter
   (declare (salience ?*medium-low-priority*))
   (preferred-flavor bitter)
   =>
   (assert (attribute (name best-flavor) (value hoppy-bitter) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-flavor-is-fruity
   (declare (salience ?*medium-low-priority*))
   (preferred-flavor fruity)
   =>
   (assert (attribute (name best-flavor) (value fruity-spicy) (certainty 20))))

; determine best beer attributes for meal type recognized...

   ; ... if main meal is cheese

(defrule determine-best-beer-attributes-if-which-cheese-style-is-fresh
   (declare (salience ?*medium-low-priority*))
   (which-cheese-style fresh)
   =>
   (assert (attribute (name best-style) (value "Wheat Beer") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Fruit Lambic") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Lambic/Gueuze") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-fresh-cheese-is-Mascarpone
   (declare (salience ?*medium-low-priority*))
   (which-fresh-cheese Mascarpone)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Witbier") (certainty 90))))

(defrule determine-best-beer-attributes-if-Mascarpone-with-fruit-is-yes
   (declare (salience ?*medium-low-priority*))
   (Mascarpone-with-fruit yes)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Lambic/Gueuze") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-fresh-cheese-is-Ricotta-or-which-grain-is-bruschetta
   (declare (salience ?*medium-low-priority*))
   (or (which-fresh-cheese Ricotta)
       (which-grain-is-bruschetta))
   =>
   (assert (attribute (name best-name) (value "Honey Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-fresh-cheese-is-Chèvre
   (declare (salience ?*medium-low-priority*))
   (which-fresh-cheese Chèvre)
   =>
   (assert (attribute (name best-name) (value "American Wheat") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Hefeweizen") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Fruit Lambic") (certainty 90)))
   (assert (attribute (name best-name) (value "European-Style Export") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-fresh-cheese-is-Feta-or-which-pork-is-loin
   (declare (salience ?*medium-low-priority*))
   (or (which-fresh-cheese Feta)
       (which-pork-is-loin))
   =>
   (assert (attribute (name best-name) (value "California Common") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-fresh-cheese-is-Cream-Cheese
   (declare (salience ?*medium-low-priority*))
   (which-fresh-cheese "Cream Cheese")
   =>
   (assert (attribute (name best-name) (value "Fruit and Field Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-cheese-style-is-semi-soft
   (declare (salience ?*medium-low-priority*))
   (which-cheese-style semi-soft)
   =>
   (assert (attribute (name best-style) (value "Pale Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "German-Style Bock") (certainty 80)))
   (assert (attribute (name best-name) (value "German-Style Kölsch") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-semi-soft-cheese-is-Mozzarella
   (declare (salience ?*medium-low-priority*))
   (which-semi-soft-cheese Mozzarella)
   =>
   (assert (attribute (name best-flavor) (value crisp-clean) (certainty 50)))
   (assert (attribute (name best-name) (value "American Imperial Red Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-semi-soft-cheese-is-Colby
   (declare (salience ?*medium-low-priority*))
   (which-semi-soft-cheese Colby)
   =>
   (assert (attribute (name best-name) (value "German-Style Helles") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-semi-soft-cheese-is-Havarti
   (declare (salience ?*medium-low-priority*))
   (which-semi-soft-cheese Havarti)
   =>
   (assert (attribute (name best-name) (value "Berliner-Style Weisse") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-semi-soft-cheese-is-Monterey-Jack-or-shellfish-is-mild
   (declare (salience ?*medium-low-priority*))
   (or (which-semi-soft-cheese "Monterey Jack")
       (shellfish-is-mild yes))
   =>
   (assert (attribute (name best-name) (value "American Cream Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-cheese-style-is-firm/hard
   (declare (salience ?*medium-low-priority*))
   (which-cheese-style firm/hard)
   =>
   (assert (attribute (name best-style) (value "Bock") (certainty 80)))
   (assert (attribute (name best-style) (value "Brown Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Bohemian-Style Pilsener") (certainty 80)))
   (assert (attribute (name best-name) (value "German-Style Pilsener") (certainty 80)))
   (assert (attribute (name best-name) (value "American Imperial Stout") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-firm/hard-cheese-is-Swiss
   (declare (salience ?*medium-low-priority*))
   (which-firm/hard-cheese Swiss)
   =>
   (assert (attribute (name best-name) (value "German-Style Maibock") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-firm/hard-cheese-is-Gouda
   (declare (salience ?*medium-low-priority*))
   (which-firm/hard-cheese Gouda)
   =>
   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 50)))
   (assert (attribute (name best-name) (value "German-Style Dunkelweizen") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-type-of-Gouda-is-aged
   (declare (salience ?*medium-low-priority*))
   (which-type-of-Gouda aged)
   =>
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Brown Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Quadrupel") (certainty 90)))
   (assert (attribute (name best-name) (value "Baltic-Style Porter") (certainty 90)))
   (assert (attribute (name best-name) (value "American Black Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-type-of-Gouda-is-smoked
   (declare (salience ?*medium-low-priority*))
   (which-type-of-Gouda smoked)
   =>
   (assert (attribute (name best-name) (value "American Imperial Porter") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-firm/hard-cheese-is-Cheddar
   (declare (salience ?*medium-low-priority*))
   (which-firm/hard-cheese Cheddar)
   =>
   (assert (attribute (name best-name) (value "Irish-Style Red") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-color-of-Cheddar-is-white
   (declare (salience ?*medium-low-priority*))
   (which-color-of-Cheddar white)
   =>
   (assert (attribute (name best-name) (value "American Amber Lager") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Pilsener") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-Cheddar-seasoning-is-mild
   (declare (salience ?*medium-low-priority*))
   (which-Cheddar-seasoning mild)
   =>
   (assert (attribute (name best-name) (value "American Pale Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Mild") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-Cheddar-seasoning-is-medium
   (declare (salience ?*medium-low-priority*))
   (which-Cheddar-seasoning medium)
   =>
   (assert (attribute (name best-name) (value "American Amber Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "American Pale Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-Cheddar-seasoning-is-aged
   (declare (salience ?*medium-low-priority*))
   (which-Cheddar-seasoning aged)
   =>
   (assert (attribute (name best-flavor) (value hoppy-bitter) (certainty 50)))
   (assert (attribute (name best-name) (value "English-Style IPA") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Oatmeal Stout") (certainty 90))))

(defrule determine-best-beer-attributes-if-Cheddar-is-sharp-or-which-rich-is-grilled-lamb
   (declare (salience ?*medium-low-priority*))
   (or (Cheddar-is-sharp yes)
       (and (meat-cooking-method grilled)
            (which-rich lamb)))
   =>
   (assert (attribute (name best-name) (value "American Stout") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-color-of-Cheddar-is-white-and-which-Cheddar-seasoning-is-mild
   (declare (salience ?*medium-low-priority*))
   (which-color-of-Cheddar white)
   (which-Cheddar-seasoning mild)
   =>
   (assert (attribute (name best-name) (value "Bohemian-Style Pilsener") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-type-of-Swiss-is-Emmental-or-which-bluefish-is-grilled-salmon
   (declare (salience ?*medium-low-priority*))
   (or (which-type-of-Swiss Emmental)
       (and (fish-cooking-method grilled)
            (which-shellfish oysters)))
   =>
   (assert (attribute (name best-name) (value "German-Style Brown/Altbier") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-type-of-Swiss-is-Gruyère
   (declare (salience ?*medium-low-priority*))
   (which-type-of-Swiss Gruyère)
   =>
   (assert (attribute (name best-name) (value "English-Style Brown Porter") (certainty 90)))
   (assert (attribute (name best-name) (value "Robust Porter") (certainty 90))))

(defrule determine-best-beer-attributes-if-Swiss-is-aged
   (declare (salience ?*medium-low-priority*))
   (Swiss-is-aged yes)
   =>
   (assert (attribute (name best-name) (value "German-Style Bock") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-firm/hard-cheese-is-Parmesan
   (declare (salience ?*medium-low-priority*))
   (which-firm/hard-cheese Parmesan)
   =>
   (assert (attribute (name best-name) (value "Smoke Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-cheese-style-is-is-blue
   (declare (salience ?*medium-low-priority*))
   (which-cheese-style blue)
   =>
   (assert (attribute (name best-flavor) (value dark-roasty) (certainty 50)))
   (assert (attribute (name best-style) (value "India Pale Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "American Black Ale") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-blue-or-natural-rind-cheese-is-Stilton
   (declare (salience ?*medium-low-priority*))
   (or (which-blue-cheese Stilton)
       (which-natural-rind-cheese Stilton))
   =>
   (assert (attribute (name best-name) (value "British-Style Barley Wine Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-cheese-style-is-natural-rind
   (declare (salience ?*medium-low-priority*))
   (which-cheese-style "natural rind")
   =>
   (assert (attribute (name best-style) (value "Pale Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Golden Strong Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Blonde Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Blonde Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "American Barley Wine") (certainty 80)))
   (assert (attribute (name best-name) (value "British-Style Barley Wine Ale") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-natural-rind-cheese-is-Brie
   (declare (salience ?*medium-low-priority*))
   (which-natural-rind-cheese Brie)
   =>
   (assert (attribute (name best-flavor) (value fruity-spicy) (certainty 50)))
   (assert (attribute (name best-name) (value "Belgian-Style Blonde Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Saison") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-natural-rind-cheese-is-Camembert
   (declare (salience ?*medium-low-priority*))
   (which-natural-rind-cheese Camembert)
   =>
   (assert (attribute (name best-name) (value "Pumpkin Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-natural-rind-cheese-is-Triple-Crème
   (declare (salience ?*medium-low-priority*))
   (which-natural-rind-cheese "Triple Crème")
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Golden Strong Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Tripel") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-natural-rind-cheese-is-Mimolette
   (declare (salience ?*medium-low-priority*))
   (which-natural-rind-cheese Mimolette)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Flanders") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-cheese-style-is-washed-rind
   (declare (salience ?*medium-low-priority*))
   (which-cheese-style "washed rind")
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Blonde Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Golden Strong Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Pale Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Dubbel") (certainty 80)))
   (assert (attribute (name best-name) (value "French-Style Biére de Garde") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-washed-rind-cheese-is-Taleggio
   (declare (salience ?*medium-low-priority*))
   (which-washed-rind-cheese Taleggio)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Pale Ale") (certainty 90))))

   ; ... if main meal is entrée

(defrule determine-best-beer-attributes-if-which-entrée-is-grain
   (declare (salience ?*medium-low-priority*))
   (or (which-entrée-omnivorous grain)
       (which-entrée-vegetarian grain)
       (which-entrée-vegan grain))
   =>
   (assert (attribute (name best-flavor) (value crisp-clean) (certainty 50))))

(defrule determine-best-beer-attributes-if-which-grain-are-chips
   (declare (salience ?*medium-low-priority*))
   (which-grain chips)
   =>
   (assert (attribute (name best-name) (value "English-Style Bitter") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Pale Ale (ESB)") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Pale Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-grain-is-spaghetti
   (declare (salience ?*medium-low-priority*))
   (which-grain spaghetti)
   =>
   (assert (attribute (name best-name) (value "Blonde Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-grain-are-grits-or-which-shellfish-are-grilled-shrimps
   (declare (salience ?*medium-low-priority*))
   (or (which-grain grits)
       (and (fish-cooking-method grilled)
            (which-shellfish shrimps)))
   =>
   (assert (attribute (name best-name) (value "American Black Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-entrée-is-legumes
   (declare (salience ?*medium-low-priority*))
   (or (which-entrée-omnivorous legumes)
       (which-entrée-vegetarian legumes)
       (which-entrée-vegan legumes))
   =>
   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 50))))

(defrule determine-best-beer-attributes-if-which-which-entrée-omnivorous-is-fish
   (declare (salience ?*medium-low-priority*))
   (which-entrée-omnivorous fish)
   =>
   (assert (attribute (name best-name) (value "English-Style Bitter") (certainty 80)))
   (assert (attribute (name best-name) (value "English-Style Pale Ale (ESB)") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-fish-is-shellfish
   (declare (salience ?*medium-low-priority*))
   (which-fish shellfish)
   =>
   (assert (attribute (name best-flavor) (value fruity-spicy) (certainty 50)))
   (assert (attribute (name best-name) (value "Bohemian-Style Pilsener") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Pilsener") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-shellfish-are-mussels
   (declare (salience ?*medium-low-priority*))
   (which-shellfish mussels)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Saison") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Lambic/Gueuze") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-shellfish-are-oysters
   (declare (salience ?*medium-low-priority*))
   (which-shellfish oysters)
   =>
   (assert (attribute (name best-name) (value "Irish-Style Dry Stout") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-which-entrée-omnivorous-is-meat
   (declare (salience ?*medium-low-priority*))
   (which-entrée-omnivorous meat)
   =>
   (assert (attribute (name best-name) (value "Scotch Ale/Wee Heavy") (certainty 80)))
   (assert (attribute (name best-name) (value "Scottish-Style Ale") (certainty 80))))

(defrule determine-best-beer-attributes-if-meat-cooking-method-is-barbecue
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method barbecue)
   =>
   (assert (attribute (name best-name) (value "American Amber Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-meat-cooking-method-is-braised-or-which-dessert-is-chocolate
   (declare (salience ?*medium-low-priority*))
   (or (meat-cooking-method braised)
       (which-dessert chocolate))
   =>
   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 50)))
   (assert (attribute (name best-flavor) (value dark-roasty) (certainty 50))))

(defrule determine-best-beer-attributes-if-meat-cooking-method-is-grilled
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method grilled)
   =>
   (assert (attribute (name best-name) (value "American Pale Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "American Amber Lager") (certainty 90)))
   (assert (attribute (name best-name) (value "Vienna-Style Lager") (certainty 90)))
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Brown Porter") (certainty 90)))
   (assert (attribute (name best-name) (value "Robust Porter") (certainty 90))))

(defrule determine-best-beer-attributes-if-meat-cooking-method-is-roasted
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method roasted)
   =>
   (assert (attribute (name best-name) (value "American Pale Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Brown Porter") (certainty 90)))
   (assert (attribute (name best-name) (value "Robust Porter") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-meat-is-rich-meats
   (declare (salience ?*medium-low-priority*))
   (which-meat rich)
   =>
   (assert (attribute (name best-flavor) (value sour-tart-funky) (certainty 50))))

(defrule determine-best-beer-attributes-if-which-rich-is-roasted-beef-or-which-rich-is-lamb
   (declare (salience ?*medium-low-priority*))
   (or (and (meat-cooking-method roasted)
            (which-rich beef))
       (which-rich lamb))
   =>
   (assert (attribute (name best-name) (value "English-Style Old Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-beef-is-bresola
   (declare (salience ?*medium-low-priority*))
   (which-beef bresola)
   =>
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "Rye Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-rich-is-roasted-lamb
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method roasted)
   (which-rich lamb)
   =>
   (assert (attribute (name best-name) (value "French-Style Biére de Garde") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-rich-is-pork
   (declare (salience ?*medium-low-priority*))
   (which-rich pork)
   =>
   (assert (attribute (name best-flavor) (value hoppy-bitter) (certainty 50)))
   (assert (attribute (name best-flavor) (value fruity-spicy) (certainty 50)))
   (assert (attribute (name best-name) (value "German-Style Doppelbock") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-rich-is-roasted-pork-or-which-meat-is-steak
   (declare (salience ?*medium-low-priority*))
   (or (and (meat-cooking-method roasted)
            (which-rich pork))
       (which-meat steak))
   =>
   (assert (attribute (name best-name) (value "English-Style Brown Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-tenderloin
   (declare (salience ?*medium-low-priority*))
   (which-pork tenderloin)
   =>
   (assert (attribute (name best-name) (value "Coffee Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-prosciutto
   (declare (salience ?*medium-low-priority*))
   (which-pork prosciutto)
   =>
   (assert (attribute (name best-name) (value "Bohemian-Style Pilsener") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Doppelbock") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Saison") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-speck
   (declare (salience ?*medium-low-priority*))
   (which-pork speck)
   =>
   (assert (attribute (name best-name) (value "Smoke Beer") (certainty 90)))
   (assert (attribute (name best-name) (value "American Pale Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-mortadella
   (declare (salience ?*medium-low-priority*))
   (which-pork mortadella)
   =>
   (assert (attribute (name best-name) (value "German-Style Märzen/Oktoberfest") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Tripel") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-sausage
   (declare (salience ?*medium-low-priority*))
   (which-pork sausage)
   =>
   (assert (attribute (name best-name) (value "German-Style Dunkel") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-grilled-sausage
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method grilled)
   (which-pork sausage)
   =>
   (assert (attribute (name best-name) (value "Smoke Porter") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-sausage-is-capocollo
   (declare (salience ?*medium-low-priority*))
   (which-sausage capocollo)
   =>
   (assert (attribute (name best-name) (value "American Amber Lager") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Pale Ale (ESB)") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-sausage-is-soppressata
   (declare (salience ?*medium-low-priority*))
   (which-sausage soppressata)
   =>
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Dubbel") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-sausage-is-salame-piccante
   (declare (salience ?*medium-low-priority*))
   (which-sausage "salame piccante")
   =>
   (assert (attribute (name best-name) (value "Imperial IPA") (certainty 90)))
   (assert (attribute (name best-name) (value "Rye Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-poultry-is-chicken
   (declare (salience ?*medium-low-priority*))
   (which-poultry chicken)
   =>
   (assert (attribute (name best-name) (value "German-Style Weizenbock") (certainty 90)))
   (assert (attribute (name best-name) (value "Bohemian-Style Pilsener") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Pilsener") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-poultry-is-roasted-chicken
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method roasted)
   (which-poultry chicken)
   =>
   (assert (attribute (name best-name) (value "English-Style Bitter") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Pale Ale (ESB)") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Dunkelweizen") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-poultry-is-roasted-turkey
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method roasted)
   (which-poultry turkey)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Tripel") (certainty 90)))
   (assert (attribute (name best-name) (value "Pumpkin Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-meat-is-game
   (declare (salience ?*medium-low-priority*))
   (which-meat game)
   =>
   (assert (attribute (name best-name) (value "Scotch Ale/Wee Heavy") (certainty 90)))
   (assert (attribute (name best-name) (value "Scottish-Style Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-meat-is-grilled-or-roasted-game
   (declare (salience ?*medium-low-priority*))
   (or (meat-cooking-method grilled)
       (meat-cooking-method roasted))
   (which-meat game)
   =>
   (assert (attribute (name best-name) (value "American Brett") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-game-is-wild-or-which-other-vegetables-are-mushrooms
   (declare (salience ?*medium-low-priority*))
   (or (which-game wild)
       (which-other-vegetables mushrooms))
   =>
   (assert (attribute (name best-name) (value "English-Style Mild") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-game-is-birds
   (declare (salience ?*medium-low-priority*))
   (which-game birds)
   =>
   (assert (attribute (name best-flavor) (value hoppy-bitter) (certainty 50))))

(defrule determine-best-beer-attributes-if-which-game-birds-is-roasted-duck
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method roasted)
   (which-game-birds duck)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Quadrupel") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-meat-is-grilled-steak
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method grilled)
   (which-meat steak)
   =>
   (assert (attribute (name best-name) (value "European-Style Export") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-entrée-is-vegetables
   (declare (salience ?*medium-low-priority*))
   (or (which-entrée-omnivorous vegetables)
       (which-entrée-vegetarian vegetables)
       (which-entrée-vegan vegetables))
   =>
   (assert (attribute (name best-name) (value "American Amber Lager") (certainty 80)))
   (assert (attribute (name best-name) (value "Vienna-Style Lager") (certainty 80)))
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-vegetables-is-root
   (declare (salience ?*medium-low-priority*))
   (which-vegetables root)
   =>
   (assert (attribute (name best-flavor) (value sour-tart-funky) (certainty 50))))

(defrule determine-best-beer-attributes-if-which-vegetables-is-salad
   (declare (salience ?*medium-low-priority*))
   (which-vegetables salad)
   =>
   (assert (attribute (name best-name) (value "American Wheat") (certainty 90)))
   (assert (attribute (name best-name) (value "American Cream Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "Bohemian-Style Pilsener") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Pilsener") (certainty 90)))
   (assert (attribute (name best-name) (value "Fruit and Field Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-vegetables-cooking-method-is-grilled
   (declare (salience ?*medium-low-priority*))
   (vegetables-cooking-method grilled)
   =>
   (assert (attribute (name best-flavor) (value dark-roasty) (certainty 50)))
   (assert (attribute (name best-name) (value "Smoke Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-vegetables-cooking-method-is-roasted
   (declare (salience ?*medium-low-priority*))
   (vegetables-cooking-method roasted)
   =>
   (assert (attribute (name best-name) (value "German-Style Dunkel") (certainty 90)))
   (assert (attribute (name best-name) (value "Irish-Style Red") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-entrée-is-fats
   (declare (salience ?*medium-low-priority*))
   (or (which-entrée-omnivorous fats)
       (which-entrée-vegetarian "vegetable fats")
       (which-entrée-vegan "vegetable fats"))
   =>
   (assert (attribute (name best-flavor) (value hoppy-bitter) (certainty 50)))
   (assert (attribute (name best-flavor) (value dark-roasty) (certainty 50))))

(defrule determine-best-beer-attributes-if-which-fats-is-vegetable
   (declare (salience ?*medium-low-priority*))
   (or (which-fats vegetable)
       (which-entrée-vegetarian "vegetables fats")
       (which-entrée-vegan "vegetables fats"))
   =>
   (assert (attribute (name best-carbonation) (value high) (certainty 50)))
   (assert (attribute (name best-carbonation) (value medium) (certainty 25))))

   ; ... if main meal is dessert

(defrule determine-best-beer-attributes-if-which-chocolate-is-white
   (declare (salience ?*medium-low-priority*))
   (which-chocolate white)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Witbier") (certainty 90)))
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-chocolate-is-milk
   (declare (salience ?*medium-low-priority*))
   (which-chocolate milk)
   =>
   (assert (attribute (name best-name) (value "American Pale Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Doppelbock") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Pale Ale (ESB)") (certainty 90)))
   (assert (attribute (name best-name) (value "American Amber Lager") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-chocolate-is-semisweet
   (declare (salience ?*medium-low-priority*))
   (which-chocolate semisweet)
   =>
   (assert (attribute (name best-name) (value "American Stout") (certainty 90)))
   (assert (attribute (name best-name) (value "Robust Porter") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Dubbel") (certainty 90)))
   (assert (attribute (name best-name) (value "American IPA") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-chocolate-is-bittersweet
   (declare (salience ?*medium-low-priority*))
   (which-chocolate bittersweet)
   =>
   (assert (attribute (name best-name) (value "American Imperial Stout") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Dubbel") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Quadrupel") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Fruit Lambic") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Lambic/Gueuze") (certainty 90)))
   (assert (attribute (name best-name) (value "Robust Porter") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-chocolate-is-unsweetened/bitter-or-which-entrée-vegan-is-chocolate
   (declare (salience ?*medium-low-priority*))
   (or (which-chocolate unsweetened/bitter)
       (which-entrée-vegan chocolate))
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Flanders") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Fruit Lambic") (certainty 90)))
   (assert (attribute (name best-name) (value "American Sour") (certainty 90))))

;(defrule determine-best-beer-attributes-if-predominant-dish-taste-is-sweet
;   (declare (salience ?*medium-low-priority*))
;   (predominant-dish-taste sweet)
;   =>
;   (assert (attribute (name best-flavor) (value dark-roasty) (certainty 50))))

;(defrule determine-best-beer-attributes-if-predominant-dish-taste-is-acid
;   (declare (salience ?*medium-low-priority*))
;   (predominant-dish-taste acid)
;   =>
;   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 50))))

;(defrule determine-best-beer-attributes-if-predominant-dish-taste-is-spice
;   (declare (salience ?*medium-low-priority*))
;   (predominant-dish-taste spice)
;   =>
;   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 50)))
;   (assert (attribute (name best-flavor) (value hoppy-bitter) (certainty 50))))

;(defrule determine-best-beer-attributes-if-predominant-dish-taste-is-umami
;   (declare (salience ?*medium-low-priority*))
;   (predominant-dish-taste umami)
;   =>
;   (assert (attribute (name best-carbonation) (value high) (certainty 50)))
;   (assert (attribute (name best-carbonation) (value medium) (certainty 25))))

;(defrule determine-best-beer-attributes-if-which-entrée-is-fats-and-predominant-dish-taste-is-sweet
;   (declare (salience ?*medium-low-priority*))
;   (or (which-entrée-omnivorous fats)
;       (which-entrée-vegetarian "vegetable fats")
;       (which-entrée-vegan "vegetable fats"))
;   (predominant-dish-taste sweet)
;   =>
;   (assert (attribute (name best-alcohol) (value harsh) (certainty 50)))
;   (assert (attribute (name best-alcohol) (value noticeable) (certainty 25))))

;(defrule determine-best-beer-attributes-if-dish-cooking-method-is-dry-heat
;   (declare (salience ?*medium-low-priority*))
;   (dish-cooking-method dry-heat)
;   =>
;   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 50))))

;;************************
;;* BEER KNOWLEDGE RULES *
;;************************

; determine best beer attributes for user type and scenario recognized

(defrule determine-best-beer-attributes-if-preferred-carbonation-is-any
   (declare (salience ?*medium-low-priority*))
   (preferred-carbonation ?carbonation)
   =>
   (assert (attribute (name best-carbonation) (value ?carbonation) (certainty 20))))

(defrule determine-best-beer-attributes-if-regular-beer-drinker-is-no
   (declare (salience ?*medium-low-priority*))
   (regular-beer-drinker no)
   =>
   (assert (attribute (name best-name) (value "American Cream Ale") (certainty 20)))
   (assert (attribute (name best-name) (value "Blonde Ale") (certainty 20)))
   (assert (attribute (name best-name) (value "German-Style Helles") (certainty 20)))
   (assert (attribute (name best-name) (value "German-Style Kölsch") (certainty 20)))
   (assert (attribute (name best-name) (value "Belgian-Style Witbier") (certainty 10)))
   (assert (attribute (name best-name) (value "American Amber Ale") (certainty 10)))
   (assert (attribute (name best-name) (value "Irish-Style Red") (certainty 10)))
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 10)))
   (assert (attribute (name best-name) (value "English-Style Brown Porter") (certainty 10))))

(defrule determine-best-beer-attributes-if-preferred-color-is-any
   (declare (salience ?*medium-low-priority*))
   (preferred-color ?color)
   =>
   (assert (attribute (name best-color) (value ?color) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-fermentation-is-any
   (declare (salience ?*medium-low-priority*))
   (preferred-fermentation ?fermentation)
   =>
   (assert (attribute (name best-fermentation) (value ?fermentation) (certainty 20))))

(defrule determine-best-beer-attributes-if-fermented-foods-eater-is-yes
   (declare (salience ?*medium-low-priority*))
   (fermented-foods-eater yes)
   =>
   (assert (attribute (name best-fermentation) (value wild) (certainty 20))))

(defrule determine-best-beer-attributes-if-driver-is-yes
   (declare (salience ?*medium-low-priority*))
   (driver yes)
   =>
   (assert (attribute (name best-alcohol) (value not-detectable) (certainty 20)))
   (assert (attribute (name best-alcohol) (value mild) (certainty 10))))

(defrule determine-best-beer-attributes-if-preferred-alcohol-is-low
   (declare (salience ?*medium-low-priority*))
   (preferred-alcohol low)
   =>
   (assert (attribute (name best-alcohol) (value not-detectable) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-alcohol-is-mild
   (declare (salience ?*medium-low-priority*))
   (preferred-alcohol mild)
   =>
   (assert (attribute (name best-alcohol) (value mild) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-alcohol-is-high
   (declare (salience ?*medium-low-priority*))
   (preferred-alcohol high)
   =>
   (assert (attribute (name best-alcohol) (value noticeable) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-alcohol-is-very-high
   (declare (salience ?*medium-low-priority*))
   (preferred-alcohol "very high")
   =>
   (assert (attribute (name best-alcohol) (value harsh) (certainty 20))))

(defrule determine-best-beer-attributes-if-which-cigar-is-claro
   (declare (salience ?*medium-low-priority*))
   (which-cigar claro)
   =>
   (assert (attribute (name best-style) (value "Wheat Beer") (certainty 20))))

(defrule determine-best-beer-attributes-if-which-cigar-is-maduro
   (declare (salience ?*medium-low-priority*))
   (which-cigar maduro)
   =>
   (assert (attribute (name best-style) (value "Stout") (certainty 20)))
   (assert (attribute (name best-style) (value "India Pale Ale") (certainty 20))))

(defrule determine-best-beer-attributes-if-which-cigar-is-oscuro
   (declare (salience ?*medium-low-priority*))
   (which-cigar oscuro)
   =>
   (assert (attribute (name best-style) (value "India Pale Ale") (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-flavor-is-clean
   (declare (salience ?*medium-low-priority*))
   (preferred-flavor clean)
   =>
   (assert (attribute (name best-flavor) (value crisp-clean) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-flavor-is-sweet
   (declare (salience ?*medium-low-priority*))
   (preferred-flavor sweet)
   =>
   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-flavor-is-roasty
   (declare (salience ?*medium-low-priority*))
   (preferred-flavor roasty)
   =>
   (assert (attribute (name best-flavor) (value dark-roasty) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-flavor-is-bitter
   (declare (salience ?*medium-low-priority*))
   (preferred-flavor bitter)
   =>
   (assert (attribute (name best-flavor) (value hoppy-bitter) (certainty 20))))

(defrule determine-best-beer-attributes-if-preferred-flavor-is-fruity
   (declare (salience ?*medium-low-priority*))
   (preferred-flavor fruity)
   =>
   (assert (attribute (name best-flavor) (value fruity-spicy) (certainty 20))))

; determine best beer attributes for meal type recognized...

   ; ... if main meal is cheese

(defrule determine-best-beer-attributes-if-which-cheese-style-is-fresh
   (declare (salience ?*medium-low-priority*))
   (which-cheese-style fresh)
   =>
   (assert (attribute (name best-style) (value "Wheat Beer") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Fruit Lambic") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Lambic/Gueuze") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-fresh-cheese-is-Mascarpone
   (declare (salience ?*medium-low-priority*))
   (which-fresh-cheese Mascarpone)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Witbier") (certainty 90))))

(defrule determine-best-beer-attributes-if-Mascarpone-with-fruit-is-yes
   (declare (salience ?*medium-low-priority*))
   (Mascarpone-with-fruit yes)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Lambic/Gueuze") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-fresh-cheese-is-Ricotta
   (declare (salience ?*medium-low-priority*))
   (which-fresh-cheese Ricotta)
   =>
   (assert (attribute (name best-name) (value "Honey Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-fresh-cheese-is-Chèvre
   (declare (salience ?*medium-low-priority*))
   (which-fresh-cheese Chèvre)
   =>
   (assert (attribute (name best-name) (value "American Wheat") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Hefeweizen") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Fruit Lambic") (certainty 90)))
   (assert (attribute (name best-name) (value "European-Style Export") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-fresh-cheese-is-Feta
   (declare (salience ?*medium-low-priority*))
   (which-fresh-cheese Feta)
   =>
   (assert (attribute (name best-name) (value "California Common") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-fresh-cheese-is-Cream-Cheese
   (declare (salience ?*medium-low-priority*))
   (which-fresh-cheese "Cream Cheese")
   =>
   (assert (attribute (name best-name) (value "Fruit and Field Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-cheese-style-is-semi-soft
   (declare (salience ?*medium-low-priority*))
   (which-cheese-style semi-soft)
   =>
   (assert (attribute (name best-style) (value "Pale Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "German-Style Bock") (certainty 80)))
   (assert (attribute (name best-name) (value "German-Style Kölsch") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-semi-soft-cheese-is-Mozzarella
   (declare (salience ?*medium-low-priority*))
   (which-semi-soft-cheese Mozzarella)
   =>
   (assert (attribute (name best-flavor) (value crisp-clean) (certainty 50)))
   (assert (attribute (name best-name) (value "American Imperial Red Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-semi-soft-cheese-is-Colby
   (declare (salience ?*medium-low-priority*))
   (which-semi-soft-cheese Colby)
   =>
   (assert (attribute (name best-name) (value "German-Style Helles") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-semi-soft-cheese-is-Havarti
   (declare (salience ?*medium-low-priority*))
   (which-semi-soft-cheese Havarti)
   =>
   (assert (attribute (name best-name) (value "Berliner-Style Weisse") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-semi-soft-cheese-is-Monterey-Jack
   (declare (salience ?*medium-low-priority*))
   (which-semi-soft-cheese "Monterey Jack")
   =>
   (assert (attribute (name best-name) (value "American Cream Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-cheese-style-is-firm/hard
   (declare (salience ?*medium-low-priority*))
   (which-cheese-style firm/hard)
   =>
   (assert (attribute (name best-style) (value "Bock") (certainty 80)))
   (assert (attribute (name best-style) (value "Brown Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Bohemian-Style Pilsener") (certainty 80)))
   (assert (attribute (name best-name) (value "German-Style Pilsener") (certainty 80)))
   (assert (attribute (name best-name) (value "American Imperial Stout") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-firm/hard-cheese-is-Swiss
   (declare (salience ?*medium-low-priority*))
   (which-firm/hard-cheese Swiss)
   =>
   (assert (attribute (name best-name) (value "German-Style Maibock") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-firm/hard-cheese-is-Gouda
   (declare (salience ?*medium-low-priority*))
   (which-firm/hard-cheese Gouda)
   =>
   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 50)))
   (assert (attribute (name best-name) (value "German-Style Dunkelweizen") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-type-of-Gouda-is-aged
   (declare (salience ?*medium-low-priority*))
   (which-type-of-Gouda aged)
   =>
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Brown Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Quadrupel") (certainty 90)))
   (assert (attribute (name best-name) (value "Baltic-Style Porter") (certainty 90)))
   (assert (attribute (name best-name) (value "American Black Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-type-of-Gouda-is-smoked
   (declare (salience ?*medium-low-priority*))
   (which-type-of-Gouda smoked)
   =>
   (assert (attribute (name best-name) (value "American Imperial Porter") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-firm/hard-cheese-is-Cheddar
   (declare (salience ?*medium-low-priority*))
   (which-firm/hard-cheese Cheddar)
   =>
   (assert (attribute (name best-name) (value "Irish-Style Red") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-color-of-Cheddar-is-white
   (declare (salience ?*medium-low-priority*))
   (which-color-of-Cheddar white)
   =>
   (assert (attribute (name best-name) (value "American Amber Lager") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Pilsener") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-Cheddar-seasoning-is-mild
   (declare (salience ?*medium-low-priority*))
   (which-Cheddar-seasoning mild)
   =>
   (assert (attribute (name best-name) (value "American Pale Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Mild") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-Cheddar-seasoning-is-medium
   (declare (salience ?*medium-low-priority*))
   (which-Cheddar-seasoning medium)
   =>
   (assert (attribute (name best-name) (value "American Amber Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "American Pale Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-Cheddar-seasoning-is-aged
   (declare (salience ?*medium-low-priority*))
   (which-Cheddar-seasoning aged)
   =>
   (assert (attribute (name best-flavor) (value hoppy-bitter) (certainty 50)))
   (assert (attribute (name best-name) (value "English-Style IPA") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Oatmeal Stout") (certainty 90))))

(defrule determine-best-beer-attributes-if-Cheddar-is-sharp
   (declare (salience ?*medium-low-priority*))
   (Cheddar-is-sharp yes)
   =>
   (assert (attribute (name best-name) (value "American Stout") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-color-of-Cheddar-is-white-and-which-Cheddar-seasoning-is-mild
   (declare (salience ?*medium-low-priority*))
   (which-color-of-Cheddar white)
   (which-Cheddar-seasoning mild)
   =>
   (assert (attribute (name best-name) (value "Bohemian-Style Pilsener") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-type-of-Swiss-is-Emmental
   (declare (salience ?*medium-low-priority*))
   (which-type-of-Swiss Emmental)
   =>
   (assert (attribute (name best-name) (value "German-Style Brown/Altbier") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-type-of-Swiss-is-Gruyère
   (declare (salience ?*medium-low-priority*))
   (which-type-of-Swiss Gruyère)
   =>
   (assert (attribute (name best-name) (value "English-Style Brown Porter") (certainty 90)))
   (assert (attribute (name best-name) (value "Robust Porter") (certainty 90))))

(defrule determine-best-beer-attributes-if-Swiss-is-aged
   (declare (salience ?*medium-low-priority*))
   (Swiss-is-aged yes)
   =>
   (assert (attribute (name best-name) (value "German-Style Bock") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-firm/hard-cheese-is-Parmesan
   (declare (salience ?*medium-low-priority*))
   (which-firm/hard-cheese Parmesan)
   =>
   (assert (attribute (name best-name) (value "Smoke Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-cheese-style-is-is-blue
   (declare (salience ?*medium-low-priority*))
   (which-cheese-style blue)
   =>
   (assert (attribute (name best-flavor) (value dark-roasty) (certainty 50)))
   (assert (attribute (name best-style) (value "India Pale Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "American Black Ale") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-blue-or-natural-rind-cheese-is-Stilton
   (declare (salience ?*medium-low-priority*))
   (or (which-blue-cheese Stilton)
       (which-natural-rind-cheese Stilton))
   =>
   (assert (attribute (name best-name) (value "British-Style Barley Wine Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-cheese-style-is-natural-rind
   (declare (salience ?*medium-low-priority*))
   (which-cheese-style "natural rind")
   =>
   (assert (attribute (name best-style) (value "Pale Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Golden Strong Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Blonde Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Blonde Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "American Barley Wine") (certainty 80)))
   (assert (attribute (name best-name) (value "British-Style Barley Wine Ale") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-natural-rind-cheese-is-Brie
   (declare (salience ?*medium-low-priority*))
   (which-natural-rind-cheese Brie)
   =>
   (assert (attribute (name best-flavor) (value fruity-spicy) (certainty 50)))
   (assert (attribute (name best-name) (value "Belgian-Style Blonde Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Saison") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-natural-rind-cheese-is-Camembert
   (declare (salience ?*medium-low-priority*))
   (which-natural-rind-cheese Camembert)
   =>
   (assert (attribute (name best-name) (value "Pumpkin Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-natural-rind-cheese-is-Triple-Crème
   (declare (salience ?*medium-low-priority*))
   (which-natural-rind-cheese "Triple Crème")
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Golden Strong Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Tripel") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-natural-rind-cheese-is-Mimolette
   (declare (salience ?*medium-low-priority*))
   (which-natural-rind-cheese Mimolette)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Flanders") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-cheese-style-is-washed-rind
   (declare (salience ?*medium-low-priority*))
   (which-cheese-style "washed rind")
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Blonde Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Golden Strong Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Pale Ale") (certainty 80)))
   (assert (attribute (name best-name) (value "Belgian-Style Dubbel") (certainty 80)))
   (assert (attribute (name best-name) (value "French-Style Biére de Garde") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-washed-rind-cheese-is-Taleggio
   (declare (salience ?*medium-low-priority*))
   (which-washed-rind-cheese Taleggio)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Pale Ale") (certainty 90))))

   ; ... if main meal is entrée

(defrule determine-best-beer-attributes-if-which-entrée-is-grain
   (declare (salience ?*medium-low-priority*))
   (or (which-entrée-omnivorous grain)
       (which-entrée-vegetarian grain)
       (which-entrée-vegan grain))
   =>
   (assert (attribute (name best-flavor) (value crisp-clean) (certainty 50))))

(defrule determine-best-beer-attributes-if-which-grain-are-chips
   (declare (salience ?*medium-low-priority*))
   (which-grain chips)
   =>
   (assert (attribute (name best-name) (value "English-Style Bitter") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Pale Ale (ESB)") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Pale Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-grain-is-spaghetti
   (declare (salience ?*medium-low-priority*))
   (which-grain spaghetti)
   =>
   (assert (attribute (name best-name) (value "Blonde Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-grain-is-bruschetta
   (declare (salience ?*medium-low-priority*))
   (which-grain bruschetta)
   =>
   (assert (attribute (name best-name) (value "Honey Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-grain-are-grits
   (declare (salience ?*medium-low-priority*))
   (which-grain grits)
   =>
   (assert (attribute (name best-name) (value "American Black Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-entrée-is-legumes
   (declare (salience ?*medium-low-priority*))
   (or (which-entrée-omnivorous legumes)
       (which-entrée-vegetarian legumes)
       (which-entrée-vegan legumes))
   =>
   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 50))))

(defrule determine-best-beer-attributes-if-which-which-entrée-omnivorous-is-fish
   (declare (salience ?*medium-low-priority*))
   (which-entrée-omnivorous fish)
   =>
   (assert (attribute (name best-name) (value "English-Style Bitter") (certainty 80)))
   (assert (attribute (name best-name) (value "English-Style Pale Ale (ESB)") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-fish-is-shellfish
   (declare (salience ?*medium-low-priority*))
   (which-fish shellfish)
   =>
   (assert (attribute (name best-flavor) (value fruity-spicy) (certainty 50)))
   (assert (attribute (name best-name) (value "Bohemian-Style Pilsener") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Pilsener") (certainty 90))))

(defrule determine-best-beer-attributes-if-shellfish-is-mild
   (declare (salience ?*medium-low-priority*))
   (shellfish-is-mild yes)
   =>
   (assert (attribute (name best-name) (value "American Cream Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-shellfish-are-grilled-shrimps
   (declare (salience ?*medium-low-priority*))
   (fish-cooking-method grilled)
   (which-shellfish shrimps)
   =>
   (assert (attribute (name best-name) (value "American Black Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-shellfish-are-mussels
   (declare (salience ?*medium-low-priority*))
   (which-shellfish mussels)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Saison") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Lambic/Gueuze") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-shellfish-are-oysters
   (declare (salience ?*medium-low-priority*))
   (which-shellfish oysters)
   =>
   (assert (attribute (name best-name) (value "Irish-Style Dry Stout") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-bluefish-is-grilled-salmon
   (declare (salience ?*medium-low-priority*))
   (fish-cooking-method grilled)
   (which-shellfish oysters)
   =>
   (assert (attribute (name best-name) (value "German-Style Brown/Altbier") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-which-entrée-omnivorous-is-meat
   (declare (salience ?*medium-low-priority*))
   (which-entrée-omnivorous meat)
   =>
   (assert (attribute (name best-name) (value "Scotch Ale/Wee Heavy") (certainty 80)))
   (assert (attribute (name best-name) (value "Scottish-Style Ale") (certainty 80))))

(defrule determine-best-beer-attributes-if-meat-cooking-method-is-barbecue
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method barbecue)
   =>
   (assert (attribute (name best-name) (value "American Amber Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-meat-cooking-method-is-braised-or-which-dessert-is-chocolate
   (declare (salience ?*medium-low-priority*))
   (or (meat-cooking-method braised)
       (which-dessert chocolate))
   =>
   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 50)))
   (assert (attribute (name best-flavor) (value dark-roasty) (certainty 50))))

(defrule determine-best-beer-attributes-if-meat-cooking-method-is-grilled
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method grilled)
   =>
   (assert (attribute (name best-name) (value "American Pale Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "American Amber Lager") (certainty 90)))
   (assert (attribute (name best-name) (value "Vienna-Style Lager") (certainty 90)))
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Brown Porter") (certainty 90)))
   (assert (attribute (name best-name) (value "Robust Porter") (certainty 90))))

(defrule determine-best-beer-attributes-if-meat-cooking-method-is-roasted
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method roasted)
   =>
   (assert (attribute (name best-name) (value "American Pale Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Brown Porter") (certainty 90)))
   (assert (attribute (name best-name) (value "Robust Porter") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-meat-is-rich-meats
   (declare (salience ?*medium-low-priority*))
   (which-meat rich)
   =>
   (assert (attribute (name best-flavor) (value sour-tart-funky) (certainty 50))))

(defrule determine-best-beer-attributes-if-which-rich-is-roasted-beef
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method roasted)
   (which-rich beef)
   =>
   (assert (attribute (name best-name) (value "English-Style Old Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-beef-is-bresola
   (declare (salience ?*medium-low-priority*))
   (which-beef bresola)
   =>
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "Rye Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-meat-is-rich-meats
   (declare (salience ?*medium-low-priority*))
   (which-rich lamb)
   =>
   (assert (attribute (name best-name) (value "English-Style Old Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-rich-is-grilled-lamb
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method grilled)
   (which-rich lamb)
   =>
   (assert (attribute (name best-name) (value "American Stout") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-rich-is-roasted-lamb
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method roasted)
   (which-rich lamb)
   =>
   (assert (attribute (name best-name) (value "French-Style Biére de Garde") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-rich-is-pork
   (declare (salience ?*medium-low-priority*))
   (which-rich pork)
   =>
   (assert (attribute (name best-flavor) (value hoppy-bitter) (certainty 50)))
   (assert (attribute (name best-flavor) (value fruity-spicy) (certainty 50)))
   (assert (attribute (name best-name) (value "German-Style Doppelbock") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-rich-is-roasted-pork
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method roasted)
   (which-rich pork)
   =>
   (assert (attribute (name best-name) (value "English-Style Brown Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-loin
   (declare (salience ?*medium-low-priority*))
   (which-pork loin)
   =>
   (assert (attribute (name best-name) (value "California Common") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-tenderloin
   (declare (salience ?*medium-low-priority*))
   (which-pork tenderloin)
   =>
   (assert (attribute (name best-name) (value "Coffee Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-prosciutto
   (declare (salience ?*medium-low-priority*))
   (which-pork prosciutto)
   =>
   (assert (attribute (name best-name) (value "Bohemian-Style Pilsener") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Doppelbock") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Saison") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-speck
   (declare (salience ?*medium-low-priority*))
   (which-pork speck)
   =>
   (assert (attribute (name best-name) (value "Smoke Beer") (certainty 90)))
   (assert (attribute (name best-name) (value "American Pale Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-mortadella
   (declare (salience ?*medium-low-priority*))
   (which-pork mortadella)
   =>
   (assert (attribute (name best-name) (value "German-Style Märzen/Oktoberfest") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Tripel") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-sausage
   (declare (salience ?*medium-low-priority*))
   (which-pork sausage)
   =>
   (assert (attribute (name best-name) (value "German-Style Dunkel") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-pork-is-grilled-sausage
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method grilled)
   (which-pork sausage)
   =>
   (assert (attribute (name best-name) (value "Smoke Porter") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-sausage-is-capocollo
   (declare (salience ?*medium-low-priority*))
   (which-sausage capocollo)
   =>
   (assert (attribute (name best-name) (value "American Amber Lager") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Pale Ale (ESB)") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-sausage-is-soppressata
   (declare (salience ?*medium-low-priority*))
   (which-sausage soppressata)
   =>
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Dubbel") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-sausage-is-salame-piccante
   (declare (salience ?*medium-low-priority*))
   (which-sausage "salame piccante")
   =>
   (assert (attribute (name best-name) (value "Imperial IPA") (certainty 90)))
   (assert (attribute (name best-name) (value "Rye Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-poultry-is-chicken
   (declare (salience ?*medium-low-priority*))
   (which-poultry chicken)
   =>
   (assert (attribute (name best-name) (value "German-Style Weizenbock") (certainty 90)))
   (assert (attribute (name best-name) (value "Bohemian-Style Pilsener") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Pilsener") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-poultry-is-roasted-chicken
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method roasted)
   (which-poultry chicken)
   =>
   (assert (attribute (name best-name) (value "English-Style Bitter") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Pale Ale (ESB)") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Dunkelweizen") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-poultry-is-roasted-turkey
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method roasted)
   (which-poultry turkey)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Tripel") (certainty 90)))
   (assert (attribute (name best-name) (value "Pumpkin Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-meat-is-game
   (declare (salience ?*medium-low-priority*))
   (which-meat game)
   =>
   (assert (attribute (name best-name) (value "Scotch Ale/Wee Heavy") (certainty 90)))
   (assert (attribute (name best-name) (value "Scottish-Style Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-meat-is-grilled-or-roasted-game
   (declare (salience ?*medium-low-priority*))
   (or (meat-cooking-method grilled)
       (meat-cooking-method roasted))
   (which-meat game)
   =>
   (assert (attribute (name best-name) (value "American Brett") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-game-is-wild
   (declare (salience ?*medium-low-priority*))
   (which-game wild)
   =>
   (assert (attribute (name best-name) (value "English-Style Mild") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Mild") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-game-is-birds
   (declare (salience ?*medium-low-priority*))
   (which-game birds)
   =>
   (assert (attribute (name best-flavor) (value hoppy-bitter) (certainty 50))))

(defrule determine-best-beer-attributes-if-which-game-birds-is-roasted-duck
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method roasted)
   (which-game-birds duck)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Quadrupel") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-meat-is-steak
   (declare (salience ?*medium-low-priority*))
   (which-meat steak)
   =>
   (assert (attribute (name best-name) (value "English-Style Brown Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-meat-is-grilled-steak
   (declare (salience ?*medium-low-priority*))
   (meat-cooking-method grilled)
   (which-meat steak)
   =>
   (assert (attribute (name best-name) (value "European-Style Export") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-entrée-is-vegetables
   (declare (salience ?*medium-low-priority*))
   (or (which-entrée-omnivorous vegetables)
       (which-entrée-vegetarian vegetables)
       (which-entrée-vegan vegetables))
   =>
   (assert (attribute (name best-name) (value "American Amber Lager") (certainty 80)))
   (assert (attribute (name best-name) (value "Vienna-Style Lager") (certainty 80)))
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 80))))

(defrule determine-best-beer-attributes-if-which-vegetables-is-root
   (declare (salience ?*medium-low-priority*))
   (which-vegetables root)
   =>
   (assert (attribute (name best-flavor) (value sour-tart-funky) (certainty 50))))

(defrule determine-best-beer-attributes-if-which-vegetables-is-salad
   (declare (salience ?*medium-low-priority*))
   (which-vegetables salad)
   =>
   (assert (attribute (name best-name) (value "American Wheat") (certainty 90)))
   (assert (attribute (name best-name) (value "American Cream Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "Bohemian-Style Pilsener") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Pilsener") (certainty 90)))
   (assert (attribute (name best-name) (value "Fruit and Field Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-other-vegetables-are-mushrooms
   (declare (salience ?*medium-low-priority*))
   (which-other-vegetables mushrooms)
   =>
   (assert (attribute (name best-name) (value "English-Style Mild") (certainty 90))))

(defrule determine-best-beer-attributes-if-vegetables-cooking-method-is-grilled
   (declare (salience ?*medium-low-priority*))
   (vegetables-cooking-method grilled)
   =>
   (assert (attribute (name best-flavor) (value dark-roasty) (certainty 50)))
   (assert (attribute (name best-name) (value "Smoke Beer") (certainty 90))))

(defrule determine-best-beer-attributes-if-vegetables-cooking-method-is-roasted
   (declare (salience ?*medium-low-priority*))
   (vegetables-cooking-method roasted)
   =>
   (assert (attribute (name best-name) (value "German-Style Dunkel") (certainty 90)))
   (assert (attribute (name best-name) (value "Irish-Style Red") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-entrée-is-fats
   (declare (salience ?*medium-low-priority*))
   (or (which-entrée-omnivorous fats)
       (which-entrée-vegetarian "vegetable fats")
       (which-entrée-vegan "vegetable fats"))
   =>
   (assert (attribute (name best-flavor) (value hoppy-bitter) (certainty 50)))
   (assert (attribute (name best-flavor) (value dark-roasty) (certainty 50))))

(defrule determine-best-beer-attributes-if-which-fats-is-vegetable
   (declare (salience ?*medium-low-priority*))
   (or (which-fats vegetable)
       (which-entrée-vegetarian "vegetables fats")
       (which-entrée-vegan "vegetables fats"))
   =>
   (assert (attribute (name best-carbonation) (value high) (certainty 50)))
   (assert (attribute (name best-carbonation) (value medium) (certainty 25))))

   ; ... if main meal is dessert

(defrule determine-best-beer-attributes-if-which-chocolate-is-white
   (declare (salience ?*medium-low-priority*))
   (which-chocolate white)
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Witbier") (certainty 90)))
   (assert (attribute (name best-name) (value "American Brown Ale") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-chocolate-is-milk
   (declare (salience ?*medium-low-priority*))
   (which-chocolate milk)
   =>
   (assert (attribute (name best-name) (value "American Pale Ale") (certainty 90)))
   (assert (attribute (name best-name) (value "German-Style Doppelbock") (certainty 90)))
   (assert (attribute (name best-name) (value "English-Style Pale Ale (ESB)") (certainty 90)))
   (assert (attribute (name best-name) (value "American Amber Lager") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-chocolate-is-semisweet
   (declare (salience ?*medium-low-priority*))
   (which-chocolate semisweet)
   =>
   (assert (attribute (name best-name) (value "American Stout") (certainty 90)))
   (assert (attribute (name best-name) (value "Robust Porter") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Dubbel") (certainty 90)))
   (assert (attribute (name best-name) (value "American IPA") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-chocolate-is-bittersweet
   (declare (salience ?*medium-low-priority*))
   (which-chocolate bittersweet)
   =>
   (assert (attribute (name best-name) (value "American Imperial Stout") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Dubbel") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Quadrupel") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Fruit Lambic") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Lambic/Gueuze") (certainty 90)))
   (assert (attribute (name best-name) (value "Robust Porter") (certainty 90))))

(defrule determine-best-beer-attributes-if-which-chocolate-is-unsweetened/bitter-or-which-entrée-vegan-is-chocolate
   (declare (salience ?*medium-low-priority*))
   (or (which-chocolate unsweetened/bitter)
       (which-entrée-vegan chocolate))
   =>
   (assert (attribute (name best-name) (value "Belgian-Style Flanders") (certainty 90)))
   (assert (attribute (name best-name) (value "Belgian-Style Fruit Lambic") (certainty 90)))
   (assert (attribute (name best-name) (value "American Sour") (certainty 90))))

;(defrule determine-best-beer-attributes-if-predominant-dish-taste-is-sweet
;   (declare (salience ?*medium-low-priority*))
;   (predominant-dish-taste sweet)
;   =>
;   (assert (attribute (name best-flavor) (value dark-roasty) (certainty 50))))

;(defrule determine-best-beer-attributes-if-predominant-dish-taste-is-acid
;   (declare (salience ?*medium-low-priority*))
;   (predominant-dish-taste acid)
;   =>
;   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 50))))

;(defrule determine-best-beer-attributes-if-predominant-dish-taste-is-spice
;   (declare (salience ?*medium-low-priority*))
;   (predominant-dish-taste spice)
;   =>
;   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 50)))
;   (assert (attribute (name best-flavor) (value hoppy-bitter) (certainty 50))))

;(defrule determine-best-beer-attributes-if-predominant-dish-taste-is-umami
;   (declare (salience ?*medium-low-priority*))
;   (predominant-dish-taste umami)
;   =>
;   (assert (attribute (name best-carbonation) (value high) (certainty 50)))
;   (assert (attribute (name best-carbonation) (value medium) (certainty 25))))

;(defrule determine-best-beer-attributes-if-which-entrée-is-fats-and-predominant-dish-taste-is-sweet
;   (declare (salience ?*medium-low-priority*))
;   (or (which-entrée-omnivorous fats)
;       (which-entrée-vegetarian "vegetable fats")
;       (which-entrée-vegan "vegetable fats"))
;   (predominant-dish-taste sweet)
;   =>
;   (assert (attribute (name best-alcohol) (value harsh) (certainty 50)))
;   (assert (attribute (name best-alcohol) (value noticeable) (certainty 25))))

;(defrule determine-best-beer-attributes-if-dish-cooking-method-is-dry-heat
;   (declare (salience ?*medium-low-priority*))
;   (dish-cooking-method dry-heat)
;   =>
;   (assert (attribute (name best-flavor) (value malty-sweet) (certainty 50))))


fixed persons heights

fixed persons heights

(deffacts initialPersons

	(Person
		(name "Ali")
		(gender m)
		(birthYear 1925)
		(height 180)
		(parents "" "")
		(siblings "" "")
		(spouse "Mona")
	)

	(Person
		(name "Mona")
		(gender f)
		(birthYear 1930)
		(height 160)
		(parents "" "")
		(siblings "" "")
		(spouse "Ali")
	)

	(Person
		(name "Sami")
		(gender m)
		(birthYear 1950)
		(height 175)
		(parents "Ali" "Mona")
		(siblings "Hassan" "Hala")
		(spouse "Nadia")
	)

	(Person
		(name "Nadia")
		(gender f)
		(birthYear 1951)
		(height 165)
		(parents "" "")
		(siblings "" "")
		(spouse "Sami")
	)

	(Person
		(name "Hala")
		(gender f)
		(birthYear 1955)
		(height 150)
		(parents "Ali" "Mona")
		(siblings "Sami" "Hassan")
		(spouse "Zein")
	)

	(Person
		(name "Hassan")
		(gender m)
		(birthYear 1952)
		(height 170)
		(parents "Ali" "Mona")
		(siblings "Hala""Sami")
		(spouse "Nahed")
	)

	(Person
		(name "Nahed")
		(gender  f)
		(birthYear 1955)
		(height  155)
		(parents "" "")
		(siblings "")
		(spouse "Hassan")
	)

	(Person
		(name "Zein")
		(gender m)
		(birthYear 1950)
		(height  180)
		(parents "" "")
		(siblings "")
		(spouse "Hala")
	)

	(Person
		(name "Ahmed")
		(gender m)
		(birthYear 1975)
		(height  173)
		(parents "Sami" "Nadia")
		(siblings "Salma")
		(spouse "")
	)

	(Person
		(name "Salma")
		(gender  f)
		(birthYear 1978)
		(height  162)
		(parents "Sami" "Nadia")
		(siblings "Ahmed")
		(spouse "")
	)

	(Person
		(name "Hani")
		(gender m)
		(birthYear 1980)
		(height  173)
		(parents "Hassan" "Nahed")
		(siblings "Laila")
		(spouse "")
	)

	(Person
		(name "Laila")
		(gender  f)
		(birthYear 1979)
		(height  160)
		(parents "Hassan Nahed" "")
		(siblings "Hani" "")
		(spouse "")
	)

	(Person
		(name "Hana")
		(gender  f)
		(birthYear 1985)
		(height  168)
		(parents "Zein Hala" "")
		(siblings "Mai" "")
		(spouse "")
	)
	(Person
		(name "Mai")
		(gender  f)
		(birthYear 1986)
		(height  155)
		(parents "Zein Hala" "")
		(siblings "Hana" "")
		(spouse "")
	)

	(Person
		(name "Adam")
		(gender m)
		(birthYear 2001)
		(height  150)
		(parents "Ahmed" "")
		(siblings "Nadine" "")
		(spouse "")
	)

	(Person
		(name "Nadine")
		(gender  f)
		(birthYear 2003)
		(height  125)
		(parents "Ahmed" "")
		(siblings "Adam" "")
		(spouse "")
	)

	(Person
		(name "Salwa")
		(gender  f)
		(birthYear  2005)
		(height  120)
		(parents "Hani" "")
		(siblings "" "")
		(spouse "")
	)

	(Person
		(name "Adel")
		(gender m)
		(birthYear 2001)
		(height  135)
		(parents "Laila" "")
		(siblings "" "")
		(spouse "")
	)

	(Person
		(name "Abdullah")
		(gender m)
		(birthYear 2010)
		(height  90)
		(parents "Hana" "")
		(siblings "" "")
		(spouse "")
	)

	(Person
		(name "Hossam")
		(gender m)
		(birthYear 2010)
		(height  100)
		(parents "Mai" "")
		(siblings "" "")
		(spouse "")
	)
)

(deffacts initialPersons

	(Person
		(name "Ali")
		(gender m)
		(birthYear 1925)
		(height 180)
		(parents "" "")
		(siblings "" "")
		(spouse "Mona")
	)

	(Person
		(name "Mona")
		(gender f)
		(birthYear 1930)
		(height 160)
		(parents "" "")
		(siblings "" "")
		(spouse "Ali")
	)

	(Person
		(name "Sami")
		(gender m)
		(birthYear 1950)
		(height 175)
		(parents "Ali" "Mona")
		(siblings "Hassan" "Hala")
		(spouse "Nadia")
	)

	(Person
		(name "Nadia")
		(gender f)
		(birthYear 1951)
		(height 165)
		(parents "" "")
		(siblings "" "")
		(spouse "Sami")
	)

	(Person
		(name "Hala")
		(gender f)
		(birthYear 1955)
		(height 150)
		(parents "Ali" "Mona")
		(siblings "Sami" "Hassan")
		(spouse "Zein")
	)

	(Person
		(name "Hassan")
		(gender m)
		(birthYear 1952)
		(height 170)
		(parents "Ali" "Mona")
		(siblings "Hala""Sami")
		(spouse "Nahed")
	)

	(Person
		(name "Nahed")
		(gender  f)
		(birthYear 1955)
		(height  1.55)
		(parents "" "")
		(siblings "")
		(spouse "Hassan")
	)

	(Person
		(name "Zein")
		(gender m)
		(birthYear 1950)
		(height  1.8)
		(parents "" "")
		(siblings "")
		(spouse "Hala")
	)

	(Person
		(name "Ahmed")
		(gender m)
		(birthYear 1975)
		(height  1.73)
		(parents "Sami" "Nadia")
		(siblings "Salma")
		(spouse "")
	)

	(Person
		(name "Salma")
		(gender  f)
		(birthYear 1978)
		(height  1.62)
		(parents "Sami" "Nadia")
		(siblings "Ahmed")
		(spouse "")
	)

	(Person
		(name "Hani")
		(gender m)
		(birthYear 1980)
		(height  1.73)
		(parents "Hassan" "Nahed")
		(siblings "Laila")
		(spouse "")
	)

	(Person
		(name "Laila")
		(gender  f)
		(birthYear 1979)
		(height  1.6)
		(parents "Hassan Nahed" "")
		(siblings "Hani" "")
		(spouse "")
	)

	(Person
		(name "Hana")
		(gender  f)
		(birthYear 1985)
		(height  1.68)
		(parents "Zein Hala" "")
		(siblings "Mai" "")
		(spouse "")
	)
	(Person
		(name "Mai")
		(gender  f)
		(birthYear 1986)
		(height  1.55)
		(parents "Zein Hala" "")
		(siblings "Hana" "")
		(spouse "")
	)

	(Person
		(name "Adam")
		(gender m)
		(birthYear 2001)
		(height  1.5)
		(parents "Ahmed" "")
		(siblings "Nadine" "")
		(spouse "")
	)

	(Person
		(name "Nadine")
		(gender  f)
		(birthYear 2003)
		(height  1.25)
		(parents "Ahmed" "")
		(siblings "Adam" "")
		(spouse "")
	)

	(Person
		(name "Salwa")
		(gender  f)
		(birthYear  2005)
		(height  1.2)
		(parents "Hani" "")
		(siblings "" "")
		(spouse "")
	)

	(Person
		(name "Adel")
		(gender m)
		(birthYear 2001)
		(height  1.35)
		(parents "Laila" "")
		(siblings "" "")
		(spouse "")
	)

	(Person
		(name "Abdullah")
		(gender m)
		(birthYear 2010)
		(height  0.9)
		(parents "Hana" "")
		(siblings "" "")
		(spouse "")
	)

	(Person
		(name "Hossam")
		(gender m)
		(birthYear 2010)
		(height  1)
		(parents "Mai" "")
		(siblings "" "")
		(spouse "")
	)
)


Fixed the assert message handler

Fixed the assert message handler

It now uses the format command to wrap the variable number of arguments in a
set of parens.

;------------------------------------------------------------------------------
;Copyright (c) 2012, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * Redistributions in binary form must reproduce the above copyright
;      notice, this list of conditions and the following disclaimer in the
;      documentation and/or other materials provided with the distribution.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
;ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;DISCLAIMED. IN NO EVENT SHALL Joshua Scoggins BE LIABLE FOR ANY
;DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
;(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
;ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;------------------------------------------------------------------------------
; Environment.clp - A wrapper over a CLIPS environment
;------------------------------------------------------------------------------
(defclass core::Environment
 "A wrapper over a clips environment"
 (is-a Object InteropObject))
 ;(role concrete)
 ;(slot pointer (source composite) (access initialize-only)
 ; (visibility public)))

(defmessage-handler core::Environment init around ()
 (call-next-handler)
 (if (eq ?self:pointer 0) then
  (bind ?self:pointer (env-create))))

(defmessage-handler core::Environment destroy primary ()
                    (if (not (is-currently-executing-environment ?self:pointer)) then
                      (env-destroy ?self:pointer)
                      (return (delete-instance))
                      else
                      (printout
                        werror
                        "ERROR: attempted to destroy the executing environment."
                        crlf)
                      (return FALSE)))

(defmessage-handler core::Environment is-currently-executing-environment primary ()
                    (return (is-currently-executing-environment ?self:pointer)))

(defmessage-handler core::Environment run ($?count)
                    (bind ?size (length$ $?count))
                    (if (= 0 ?size) then
                      (if (is-currently-executing-environment ?self:pointer) then
                        (run)
                        else
                        (env-run ?self:pointer))
                      else
                      (bind ?num (nth$ 1 ?count))
                      (if (and (> ?num 0) (integerp ?num)) then
                        (if (is-currently-executing-environment ?self:pointer) then
                          (run ?num)
                          else
                          (env-run ?self:pointer ?num))
                        else
                        (printout werror "ERROR: invalid count provided." crlf))))

(defmessage-handler core::Environment eval (?string)
                    (if (stringp ?string) then
                      (if (is-currently-executing-environment ?self:pointer) then
                        (eval ?string)
                        else
                        (env-eval ?self:pointer ?string))
                      else
                      (printout werror "ERROR: string expected" crlf)))

(defmessage-handler core::Environment build (?string)
                    (if (stringp ?string) then
                      (if (is-currently-executing-environment ?self:pointer) then
                        (build ?string)
                        else
                        (env-build ?self:pointer ?string))
                      else
                      (printout werror "ERROR: string expected" crlf)))

(defmessage-handler core::Environment facts ()
                    (if (is-currently-executing-environment ?self:pointer) then
                      (facts)
                      else
                      (env-facts ?self:pointer)))
(defmessage-handler core::Environment instances ()
                    (if (is-currently-executing-environment ?self:pointer) then
                      (instances)
                      else
                      (env-instances ?self:pointer)))

(defmessage-handler core::Environment rules ()
                    (if (is-currently-executing-environment ?self:pointer) then
                      (rules)
                      else
                      (env-rules ?self:pointer)))

(defmessage-handler core::Environment assert ($?elements)
                    (bind ?length (length$ ?elements))
                    (if (= 0 ?length) then
                      (printout werror "ERROR: No arguments provided" crlf)
                      else
							 (bind ?t (implode$ $?elements))
                      (env-assert-string ?self:pointer
							  (format nil "(%s)" ?t))))

;------------------------------------------------------------------------------
;Copyright (c) 2012, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * Redistributions in binary form must reproduce the above copyright
;      notice, this list of conditions and the following disclaimer in the
;      documentation and/or other materials provided with the distribution.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
;ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;DISCLAIMED. IN NO EVENT SHALL Joshua Scoggins BE LIABLE FOR ANY
;DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
;(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
;ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;------------------------------------------------------------------------------
; Environment.clp - A wrapper over a CLIPS environment
;------------------------------------------------------------------------------
(defclass core::Environment
 "A wrapper over a clips environment"
 (is-a Object InteropObject))
 ;(role concrete)
 ;(slot pointer (source composite) (access initialize-only)
 ; (visibility public)))

(defmessage-handler core::Environment init around ()
 (call-next-handler)
 (if (eq ?self:pointer 0) then
  (bind ?self:pointer (env-create))))

(defmessage-handler core::Environment destroy primary ()
                    (if (not (is-currently-executing-environment ?self:pointer)) then
                      (env-destroy ?self:pointer)
                      (return (delete-instance))
                      else
                      (printout
                        werror
                        "ERROR: attempted to destroy the executing environment."
                        crlf)
                      (return FALSE)))

(defmessage-handler core::Environment is-currently-executing-environment primary ()
                    (return (is-currently-executing-environment ?self:pointer)))

(defmessage-handler core::Environment run ($?count)
                    (bind ?size (length$ $?count))
                    (if (= 0 ?size) then
                      (if (is-currently-executing-environment ?self:pointer) then
                        (run)
                        else
                        (env-run ?self:pointer))
                      else
                      (bind ?num (nth$ 1 ?count))
                      (if (and (> ?num 0) (integerp ?num)) then
                        (if (is-currently-executing-environment ?self:pointer) then
                          (run ?num)
                          else
                          (env-run ?self:pointer ?num))
                        else
                        (printout werror "ERROR: invalid count provided." crlf))))

(defmessage-handler core::Environment eval (?string)
                    (if (stringp ?string) then
                      (if (is-currently-executing-environment ?self:pointer) then
                        (eval ?string)
                        else
                        (env-eval ?self:pointer ?string))
                      else
                      (printout werror "ERROR: string expected" crlf)))

(defmessage-handler core::Environment build (?string)
                    (if (stringp ?string) then
                      (if (is-currently-executing-environment ?self:pointer) then
                        (build ?string)
                        else
                        (env-build ?self:pointer ?string))
                      else
                      (printout werror "ERROR: string expected" crlf)))

(defmessage-handler core::Environment facts ()
                    (if (is-currently-executing-environment ?self:pointer) then
                      (facts)
                      else
                      (env-facts ?self:pointer)))
(defmessage-handler core::Environment instances ()
                    (if (is-currently-executing-environment ?self:pointer) then
                      (instances)
                      else
                      (env-instances ?self:pointer)))

(defmessage-handler core::Environment rules ()
                    (if (is-currently-executing-environment ?self:pointer) then
                      (rules)
                      else
                      (env-rules ?self:pointer)))

(defmessage-handler core::Environment assert ($?elements)
                    (bind ?length (length$ ?elements))
                    (if (= 0 ?length) then
                      (printout werror "ERROR: No arguments provided" crlf)
                      else
                      (env-assert-string ?self:pointer
							  (implode$ $?elements))))


message template now requires the to and action slots to be set on assert

;------------------------------------------------------------------------------
;Copyright (c) 2013, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * Redistributions in binary form must reproduce the above copyright
;      notice, this list of conditions and the following disclaimer in the
;      documentation and/or other materials provided with the distribution.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
;ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;DISCLAIMED. IN NO EVENT SHALL Joshua Scoggins BE LIABLE FOR ANY
;DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
;(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
;ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;------------------------------------------------------------------------------
; Message.clp - Contains the message template which is a standard way to pass
; knowledge between modules that have no knowledge of one another.
;
; Use of messages also allows programmers to use modify and duplicate to cut
; down on the amount of redundant typing which can potentially lead to a
; reduction in the overall error rate.
;------------------------------------------------------------------------------
(deftemplate Runtime::message
             "Provides a communication medium between modules"
             (slot to
                   (type SYMBOL)
                   (default ?NONE))
             (slot from
                   (type SYMBOL))
             (slot action
                   (type SYMBOL)
                   (default ?NONE))
             (multislot arguments))
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
;Copyright (c) 2013, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * Redistributions in binary form must reproduce the above copyright
;      notice, this list of conditions and the following disclaimer in the
;      documentation and/or other materials provided with the distribution.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
;ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;DISCLAIMED. IN NO EVENT SHALL Joshua Scoggins BE LIABLE FOR ANY
;DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
;(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
;ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;------------------------------------------------------------------------------
; Message.clp - Contains the message template which is a standard way to pass
; knowledge between modules that have no knowledge of one another.
;
; Use of messages also allows programmers to use modify and duplicate to cut
; down on the amount of redundant typing which can potentially lead to a
; reduction in the overall error rate.
;------------------------------------------------------------------------------
(deftemplate Runtime::message
             "Provides a communication medium between modules"
             (slot to (type SYMBOL))
             (slot from (type SYMBOL))
             (slot action (type SYMBOL))
             (multislot arguments))
;------------------------------------------------------------------------------