SlideShare a Scribd company logo
1 of 17
Download to read offline
(deftemp Animal
(slot loc
(default greencouch))
(slot on-top-of
(default roof))
(slot hold
(default nothing)))
(deftemp thing
(slot name
(default NONE))
(slot loc
(default NONE))
(slot on-top-of
(default roof))
(slot mass
(default light weight)))
(deftemp chest
(slot name
(default NONE))
(slot contents
(default NONE))
(slot unlocked-by
(default NONE)))
(deftemp goal-was
(slot act
(default NONE))
(multislot args))
(defrule hold chest to get of roof ""
(goal-was (act unlock) (args ?chest))
(thing (name ?chest) (on-top-of ~roof) (mass light weight))
(Animal (hold ~?chest))
(not (goal-was (act hold) (args ?chest)))
=>
(assert (goal-was (act hold) (args ?chest))))
(defrule put-chest-on-roof ""
(goal-was (act unlock) (args ?chest))
?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold ?chest))
?thing <- (thing (name ?chest))
=>
(printout t "Animal throws the " ?chest " off the "
?on " onto the roof." crlf)
(modify ?Animal (hold blank))
(modify ?thing (loc ?place) (on-top-of roof)))
(defrule get-key-to-unlock ""
(goal-was (act unlock) (args ?obj))
(thing (name ?obj) (on-top-of roof))
(chest (name ?obj) (unlocked-by ?key))
(Animal (hold ~?key))
(not (goal-was (act hold) (args ?key)))
=>
(assert (goal-was (act hold) (args ?key))))
(defrule move-to-chest-with-key ""
(goal-was (act unlock) (args ?chest))
(Animal (loc ?mplace) (hold ?key))
(thing (name ?chest) (loc ?cplace&~?mplace) (on-top-of roof))
(chest (name ?chest) (unlocked-by ?key))
(not (goal-was (act walk-to) (args ?cplace)))
=>
(assert (goal-was (act walk-to) (args ?cplace))))
(defrule unlock-chest-with-key ""
?goal <- (goal-was (act unlock) (args ?name))
?chest <- (chest (name ?name) (contents ?contents) (unlocked-by ?key))
(thing (name ?name) (loc ?place) (on-top-of ?on))
(Animal (loc ?place) (on-top-of ?on) (hold ?key))
=>
(printout t "Animal opens the " ?name " with the " ?key
" revealing the " ?contents "." crlf)
(modify ?chest (contents nothing))
(assert (thing (name ?contents) (loc ?place) (on-top-of ?name)))
(retract ?goal))
;;;*********************
;;;* HOLD OBJECT RULES *
;;;*********************
(defrule unlock-chest-to-hold-object ""
(goal-was (act hold) (args ?obj))
(chest (name ?chest) (contents ?obj))
(not (goal-was (act unlock) (args ?chest)))
=>
(assert (goal-was (act unlock) (args ?chest))))
(defrule use-ladder-to-hold ""
(goal-was (act hold) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ceiling) (mass light weight))
(not (thing (name ladder) (loc ?place)))
(not (goal-was (act move) (args ladder ?place)))
=>
(assert (goal-was (act move) (args ladder ?place))))
(defrule climb-ladder-to-hold ""
(goal-was (act hold) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ceiling) (mass light weight))
(thing (name ladder) (loc ?place) (on-top-of roof))
(Animal (on-top-of ~ladder))
(not (goal-was (act on) (args ladder)))
=>
(assert (goal-was (act on) (args ladder))))
(defrule grab-object-from-ladder ""
?goal <- (goal-was (act hold) (args ?name))
?thing <- (thing (name ?name) (loc ?place)
(on-top-of ceiling) (mass light weight))
(thing (name ladder) (loc ?place))
?Animal <- (Animal (loc ?place) (on-top-of ladder) (hold blank))
=>
(printout t "Animal grabs the " ?name "." crlf)
(modify ?thing (loc held) (on-top-of held))
(modify ?Animal (hold ?name))
(retract ?goal))
(defrule climb-to-hold ""
(goal-was (act hold) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ?on&~ceiling) (mass light weight))
(Animal (loc ?place) (on-top-of ~?on))
(not (goal-was (act on) (args ?on)))
=>
(assert (goal-was (act on) (args ?on))))
(defrule walk-to-hold ""
(goal-was (act hold) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ~ceiling) (mass light weight))
(Animal (loc ~?place))
(not (goal-was (act walk-to) (args ?place)))
=>
(assert (goal-was (act walk-to) (args ?place))))
(defrule drop-to-hold ""
(goal-was (act hold) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ?on) (mass light weight))
(Animal (loc ?place) (on-top-of ?on) (hold ~blank))
(not (goal-was (act hold) (args blank)))
=>
(assert (goal-was (act hold) (args blank))))
(defrule grab-object ""
?goal <- (goal-was (act hold) (args ?name))
?thing <- (thing (name ?name) (loc ?place)
(on-top-of ?on) (mass light weight))
?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold blank))
=>
(printout t "Animal grabs the " ?name "." crlf)
(modify ?thing (loc held) (on-top-of held))
(modify ?Animal (hold ?name))
(retract ?goal))
(defrule drop-object ""
?goal <- (goal-was (act hold) (args blank))
?Animal <- (Animal (loc ?place)
(on-top-of ?on)
(hold ?name&~blank))
?thing <- (thing (name ?name))
=>
(printout t "Animal drops the " ?name "." crlf)
(modify ?Animal (hold blank))
(modify ?thing (loc ?place) (on-top-of ?on))
(retract ?goal))
;;;*********************
;;;* MOVE OBJECT RULES *
;;;*********************
(defrule unlock-chest-to-move-object ""
(goal-was (act move) (args ?obj ?))
(chest (name ?chest) (contents ?obj))
(not (goal-was (act unlock) (args ?chest)))
=>
(assert (goal-was (act unlock) (args ?chest))))
(defrule hold-object-to-move ""
(goal-was (act move) (args ?obj ?place))
(thing (name ?obj) (loc ~?place) (mass light weight))
(Animal (hold ~?obj))
(not (goal-was (act hold) (args ?obj)))
=>
(assert (goal-was (act hold) (args ?obj))))
(defrule move-object-to-place ""
(goal-was (act move) (args ?obj ?place))
(Animal (loc ~?place) (hold ?obj))
(not (goal-was (act walk-to) (args ?place)))
=>
(assert (goal-was (act walk-to) (args ?place))))
(defrule drop-object-once-moved ""
?goal <- (goal-was (act move) (args ?name ?place))
?Animal <- (Animal (loc ?place) (hold ?obj))
?thing <- (thing (name ?name) (mass light weight))
=>
(printout t "Animal drops the " ?name "." crlf)
(modify ?Animal (hold blank))
(modify ?thing (loc ?place) (on-top-of roof))
(retract ?goal))
(defrule already-moved-object ""
?goal <- (goal-was (act move) (args ?obj ?place))
(thing (name ?obj) (loc ?place))
=>
(retract ?goal))
;;;***********************
;;;* WALK TO PLACE RULES *
;;;***********************
(defrule already-at-place ""
?goal <- (goal-was (act walk-to) (args ?place))
(Animal (loc ?place))
=>
(retract ?goal))
(defrule get-on-roof-to-walk ""
(goal-was (act walk-to) (args ?place))
(Animal (loc ~?place) (on-top-of ~roof))
(not (goal-was (act on) (args roof)))
=>
(assert (goal-was (act on) (args roof))))
(defrule walk-hold-nothing ""
?goal <- (goal-was (act walk-to) (args ?place))
?Animal <- (Animal (loc ~?place) (on-top-of roof) (hold blank))
=>
(printout t "Animal walks to " ?place "." crlf)
(modify ?Animal (loc ?place))
(retract ?goal))
(defrule walk-hold-object ""
?goal <- (goal-was (act walk-to) (args ?place))
?Animal <- (Animal (loc ~?place) (on-top-of roof) (hold ?obj&~blank))
=>
(printout t "Animal walks to " ?place " hold the " ?obj "." crlf)
(modify ?Animal (loc ?place))
(retract ?goal))
;;;***********************
;;;* GET ON OBJECT RULES *
;;;***********************
(defrule jump-onto-roof ""
?goal <- (goal-was (act on) (args roof))
?Animal <- (Animal (on-top-of ?on&~roof))
=>
(printout t "Animal jumps off the " ?on " onto the roof." crlf)
(modify ?Animal (on-top-of roof))
(retract ?goal))
(defrule walk-to-place-to-climb ""
(goal-was (act on) (args ?obj))
(thing (name ?obj) (loc ?place))
(Animal (loc ~?place))
(not (goal-was (act walk-to) (args ?place)))
=>
(assert (goal-was (act walk-to) (args ?place))))
(defrule drop-to-climb ""
(goal-was (act on) (args ?obj))
(thing (name ?obj) (loc ?place))
(Animal (loc ?place) (hold ~blank))
(not (goal-was (act hold) (args blank)))
=>
(assert (goal-was (act hold) (args blank))))
(defrule climb-indirectly ""
(goal-was (act on) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ?on))
(Animal (loc ?place) (on-top-of ~?on&~?obj) (hold blank))
(not (goal-was (act on) (args ?on)))
=>
(assert (goal-was (act on) (args ?on))))
(defrule climb-directly ""
?goal <- (goal-was (act on) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ?on))
?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold blank))
=>
(printout t "Animal climbs onto the " ?obj "." crlf)
(modify ?Animal (on-top-of ?obj))
(retract ?goal))
(defrule already-on-object ""
?goal <- (goal-was (act on) (args ?obj))
(Animal (on-top-of ?obj))
=>
(retract ?goal))
;;;********************
;;;* EAT OBJECT RULES *
;;;********************
(defrule hold-to-eat ""
(goal-was (act eat) (args ?obj))
(Animal (hold ~?obj))
(not (goal-was (act hold) (args ?obj)))
=>
(assert (goal-was (act hold) (args ?obj))))
(defrule satisfy-hunger ""
?goal <- (goal-was (act eat) (args ?name))
?Animal <- (Animal (hold ?name))
?thing <- (thing (name ?name))
=>
(printout t "Animal eats the " ?name "." crlf)
(modify ?Animal (hold blank))
(retract ?goal ?thing))
;;;**********************
;;;* INITIAL STATE *
;;;**********************
(deffacts startup ""
(Animal (loc t5-7) (on-top-of greencouch) (hold blank))
(thing (name greencouch) (loc t5-7) (mass heavy))
(thing (name red-couch) (loc t2-2) (mass heavy))
(thing (name big-pillow) (loc t2-2) (on-top-of red-couch))
(thing (name red-chest) (loc t2-2) (on-top-of big-pillow))
(chest (name red-chest) (contents ladder) (unlocked-by red-key))
(thing (name blue-chest) (loc t7-7) (on-top-of ceiling))
(chest (name blue-chest) (contents bananas) (unlocked-by blue-key))
(thing (name blue-couch) (loc t8-8) (mass heavy))
(thing (name green-chest) (loc t8-8) (on-top-of ceiling))
(chest (name green-chest) (contents blue-key) (unlocked-by red-key))
(thing (name red-key) (loc t1-3))
(goal-was (act eat) (args bananas)))
Solution
(deftemp Animal
(slot loc
(default greencouch))
(slot on-top-of
(default roof))
(slot hold
(default nothing)))
(deftemp thing
(slot name
(default NONE))
(slot loc
(default NONE))
(slot on-top-of
(default roof))
(slot mass
(default light weight)))
(deftemp chest
(slot name
(default NONE))
(slot contents
(default NONE))
(slot unlocked-by
(default NONE)))
(deftemp goal-was
(slot act
(default NONE))
(multislot args))
(defrule hold chest to get of roof ""
(goal-was (act unlock) (args ?chest))
(thing (name ?chest) (on-top-of ~roof) (mass light weight))
(Animal (hold ~?chest))
(not (goal-was (act hold) (args ?chest)))
=>
(assert (goal-was (act hold) (args ?chest))))
(defrule put-chest-on-roof ""
(goal-was (act unlock) (args ?chest))
?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold ?chest))
?thing <- (thing (name ?chest))
=>
(printout t "Animal throws the " ?chest " off the "
?on " onto the roof." crlf)
(modify ?Animal (hold blank))
(modify ?thing (loc ?place) (on-top-of roof)))
(defrule get-key-to-unlock ""
(goal-was (act unlock) (args ?obj))
(thing (name ?obj) (on-top-of roof))
(chest (name ?obj) (unlocked-by ?key))
(Animal (hold ~?key))
(not (goal-was (act hold) (args ?key)))
=>
(assert (goal-was (act hold) (args ?key))))
(defrule move-to-chest-with-key ""
(goal-was (act unlock) (args ?chest))
(Animal (loc ?mplace) (hold ?key))
(thing (name ?chest) (loc ?cplace&~?mplace) (on-top-of roof))
(chest (name ?chest) (unlocked-by ?key))
(not (goal-was (act walk-to) (args ?cplace)))
=>
(assert (goal-was (act walk-to) (args ?cplace))))
(defrule unlock-chest-with-key ""
?goal <- (goal-was (act unlock) (args ?name))
?chest <- (chest (name ?name) (contents ?contents) (unlocked-by ?key))
(thing (name ?name) (loc ?place) (on-top-of ?on))
(Animal (loc ?place) (on-top-of ?on) (hold ?key))
=>
(printout t "Animal opens the " ?name " with the " ?key
" revealing the " ?contents "." crlf)
(modify ?chest (contents nothing))
(assert (thing (name ?contents) (loc ?place) (on-top-of ?name)))
(retract ?goal))
;;;*********************
;;;* HOLD OBJECT RULES *
;;;*********************
(defrule unlock-chest-to-hold-object ""
(goal-was (act hold) (args ?obj))
(chest (name ?chest) (contents ?obj))
(not (goal-was (act unlock) (args ?chest)))
=>
(assert (goal-was (act unlock) (args ?chest))))
(defrule use-ladder-to-hold ""
(goal-was (act hold) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ceiling) (mass light weight))
(not (thing (name ladder) (loc ?place)))
(not (goal-was (act move) (args ladder ?place)))
=>
(assert (goal-was (act move) (args ladder ?place))))
(defrule climb-ladder-to-hold ""
(goal-was (act hold) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ceiling) (mass light weight))
(thing (name ladder) (loc ?place) (on-top-of roof))
(Animal (on-top-of ~ladder))
(not (goal-was (act on) (args ladder)))
=>
(assert (goal-was (act on) (args ladder))))
(defrule grab-object-from-ladder ""
?goal <- (goal-was (act hold) (args ?name))
?thing <- (thing (name ?name) (loc ?place)
(on-top-of ceiling) (mass light weight))
(thing (name ladder) (loc ?place))
?Animal <- (Animal (loc ?place) (on-top-of ladder) (hold blank))
=>
(printout t "Animal grabs the " ?name "." crlf)
(modify ?thing (loc held) (on-top-of held))
(modify ?Animal (hold ?name))
(retract ?goal))
(defrule climb-to-hold ""
(goal-was (act hold) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ?on&~ceiling) (mass light weight))
(Animal (loc ?place) (on-top-of ~?on))
(not (goal-was (act on) (args ?on)))
=>
(assert (goal-was (act on) (args ?on))))
(defrule walk-to-hold ""
(goal-was (act hold) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ~ceiling) (mass light weight))
(Animal (loc ~?place))
(not (goal-was (act walk-to) (args ?place)))
=>
(assert (goal-was (act walk-to) (args ?place))))
(defrule drop-to-hold ""
(goal-was (act hold) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ?on) (mass light weight))
(Animal (loc ?place) (on-top-of ?on) (hold ~blank))
(not (goal-was (act hold) (args blank)))
=>
(assert (goal-was (act hold) (args blank))))
(defrule grab-object ""
?goal <- (goal-was (act hold) (args ?name))
?thing <- (thing (name ?name) (loc ?place)
(on-top-of ?on) (mass light weight))
?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold blank))
=>
(printout t "Animal grabs the " ?name "." crlf)
(modify ?thing (loc held) (on-top-of held))
(modify ?Animal (hold ?name))
(retract ?goal))
(defrule drop-object ""
?goal <- (goal-was (act hold) (args blank))
?Animal <- (Animal (loc ?place)
(on-top-of ?on)
(hold ?name&~blank))
?thing <- (thing (name ?name))
=>
(printout t "Animal drops the " ?name "." crlf)
(modify ?Animal (hold blank))
(modify ?thing (loc ?place) (on-top-of ?on))
(retract ?goal))
;;;*********************
;;;* MOVE OBJECT RULES *
;;;*********************
(defrule unlock-chest-to-move-object ""
(goal-was (act move) (args ?obj ?))
(chest (name ?chest) (contents ?obj))
(not (goal-was (act unlock) (args ?chest)))
=>
(assert (goal-was (act unlock) (args ?chest))))
(defrule hold-object-to-move ""
(goal-was (act move) (args ?obj ?place))
(thing (name ?obj) (loc ~?place) (mass light weight))
(Animal (hold ~?obj))
(not (goal-was (act hold) (args ?obj)))
=>
(assert (goal-was (act hold) (args ?obj))))
(defrule move-object-to-place ""
(goal-was (act move) (args ?obj ?place))
(Animal (loc ~?place) (hold ?obj))
(not (goal-was (act walk-to) (args ?place)))
=>
(assert (goal-was (act walk-to) (args ?place))))
(defrule drop-object-once-moved ""
?goal <- (goal-was (act move) (args ?name ?place))
?Animal <- (Animal (loc ?place) (hold ?obj))
?thing <- (thing (name ?name) (mass light weight))
=>
(printout t "Animal drops the " ?name "." crlf)
(modify ?Animal (hold blank))
(modify ?thing (loc ?place) (on-top-of roof))
(retract ?goal))
(defrule already-moved-object ""
?goal <- (goal-was (act move) (args ?obj ?place))
(thing (name ?obj) (loc ?place))
=>
(retract ?goal))
;;;***********************
;;;* WALK TO PLACE RULES *
;;;***********************
(defrule already-at-place ""
?goal <- (goal-was (act walk-to) (args ?place))
(Animal (loc ?place))
=>
(retract ?goal))
(defrule get-on-roof-to-walk ""
(goal-was (act walk-to) (args ?place))
(Animal (loc ~?place) (on-top-of ~roof))
(not (goal-was (act on) (args roof)))
=>
(assert (goal-was (act on) (args roof))))
(defrule walk-hold-nothing ""
?goal <- (goal-was (act walk-to) (args ?place))
?Animal <- (Animal (loc ~?place) (on-top-of roof) (hold blank))
=>
(printout t "Animal walks to " ?place "." crlf)
(modify ?Animal (loc ?place))
(retract ?goal))
(defrule walk-hold-object ""
?goal <- (goal-was (act walk-to) (args ?place))
?Animal <- (Animal (loc ~?place) (on-top-of roof) (hold ?obj&~blank))
=>
(printout t "Animal walks to " ?place " hold the " ?obj "." crlf)
(modify ?Animal (loc ?place))
(retract ?goal))
;;;***********************
;;;* GET ON OBJECT RULES *
;;;***********************
(defrule jump-onto-roof ""
?goal <- (goal-was (act on) (args roof))
?Animal <- (Animal (on-top-of ?on&~roof))
=>
(printout t "Animal jumps off the " ?on " onto the roof." crlf)
(modify ?Animal (on-top-of roof))
(retract ?goal))
(defrule walk-to-place-to-climb ""
(goal-was (act on) (args ?obj))
(thing (name ?obj) (loc ?place))
(Animal (loc ~?place))
(not (goal-was (act walk-to) (args ?place)))
=>
(assert (goal-was (act walk-to) (args ?place))))
(defrule drop-to-climb ""
(goal-was (act on) (args ?obj))
(thing (name ?obj) (loc ?place))
(Animal (loc ?place) (hold ~blank))
(not (goal-was (act hold) (args blank)))
=>
(assert (goal-was (act hold) (args blank))))
(defrule climb-indirectly ""
(goal-was (act on) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ?on))
(Animal (loc ?place) (on-top-of ~?on&~?obj) (hold blank))
(not (goal-was (act on) (args ?on)))
=>
(assert (goal-was (act on) (args ?on))))
(defrule climb-directly ""
?goal <- (goal-was (act on) (args ?obj))
(thing (name ?obj) (loc ?place) (on-top-of ?on))
?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold blank))
=>
(printout t "Animal climbs onto the " ?obj "." crlf)
(modify ?Animal (on-top-of ?obj))
(retract ?goal))
(defrule already-on-object ""
?goal <- (goal-was (act on) (args ?obj))
(Animal (on-top-of ?obj))
=>
(retract ?goal))
;;;********************
;;;* EAT OBJECT RULES *
;;;********************
(defrule hold-to-eat ""
(goal-was (act eat) (args ?obj))
(Animal (hold ~?obj))
(not (goal-was (act hold) (args ?obj)))
=>
(assert (goal-was (act hold) (args ?obj))))
(defrule satisfy-hunger ""
?goal <- (goal-was (act eat) (args ?name))
?Animal <- (Animal (hold ?name))
?thing <- (thing (name ?name))
=>
(printout t "Animal eats the " ?name "." crlf)
(modify ?Animal (hold blank))
(retract ?goal ?thing))
;;;**********************
;;;* INITIAL STATE *
;;;**********************
(deffacts startup ""
(Animal (loc t5-7) (on-top-of greencouch) (hold blank))
(thing (name greencouch) (loc t5-7) (mass heavy))
(thing (name red-couch) (loc t2-2) (mass heavy))
(thing (name big-pillow) (loc t2-2) (on-top-of red-couch))
(thing (name red-chest) (loc t2-2) (on-top-of big-pillow))
(chest (name red-chest) (contents ladder) (unlocked-by red-key))
(thing (name blue-chest) (loc t7-7) (on-top-of ceiling))
(chest (name blue-chest) (contents bananas) (unlocked-by blue-key))
(thing (name blue-couch) (loc t8-8) (mass heavy))
(thing (name green-chest) (loc t8-8) (on-top-of ceiling))
(chest (name green-chest) (contents blue-key) (unlocked-by red-key))
(thing (name red-key) (loc t1-3))
(goal-was (act eat) (args bananas)))

More Related Content

More from gulshan16175gs

2. The pressures of O2 and NO will be negligibleSolution 2. T.pdf
 2. The pressures of O2 and NO will be negligibleSolution 2. T.pdf 2. The pressures of O2 and NO will be negligibleSolution 2. T.pdf
2. The pressures of O2 and NO will be negligibleSolution 2. T.pdfgulshan16175gs
 
# Imports# Include your imports here, if any are used. import.pdf
 # Imports# Include your imports here, if any are used. import.pdf # Imports# Include your imports here, if any are used. import.pdf
# Imports# Include your imports here, if any are used. import.pdfgulshan16175gs
 
The OMe is a strong electron withdrawing group an.pdf
                     The OMe is a strong electron withdrawing group an.pdf                     The OMe is a strong electron withdrawing group an.pdf
The OMe is a strong electron withdrawing group an.pdfgulshan16175gs
 
O bears three lone pairs and is bound to a H, thu.pdf
                     O bears three lone pairs and is bound to a H, thu.pdf                     O bears three lone pairs and is bound to a H, thu.pdf
O bears three lone pairs and is bound to a H, thu.pdfgulshan16175gs
 
Nacl and H20 so, Salt & water .pdf
                     Nacl and H20 so, Salt & water                    .pdf                     Nacl and H20 so, Salt & water                    .pdf
Nacl and H20 so, Salt & water .pdfgulshan16175gs
 
In terms of ion charge, we notice that the charge.pdf
                     In terms of ion charge, we notice that the charge.pdf                     In terms of ion charge, we notice that the charge.pdf
In terms of ion charge, we notice that the charge.pdfgulshan16175gs
 
Here are four characteristics of acid a) A char.pdf
                     Here are four characteristics of acid  a) A char.pdf                     Here are four characteristics of acid  a) A char.pdf
Here are four characteristics of acid a) A char.pdfgulshan16175gs
 
Fe^3+(aq)Lewis acid H2O(l)Lewis baseereyedcommu .pdf
                     Fe^3+(aq)Lewis acid H2O(l)Lewis baseereyedcommu  .pdf                     Fe^3+(aq)Lewis acid H2O(l)Lewis baseereyedcommu  .pdf
Fe^3+(aq)Lewis acid H2O(l)Lewis baseereyedcommu .pdfgulshan16175gs
 
wrongSolutionwrong.pdf
wrongSolutionwrong.pdfwrongSolutionwrong.pdf
wrongSolutionwrong.pdfgulshan16175gs
 
You can use the below function for linear interpolation i.e.#inclu.pdf
You can use the below function for linear interpolation i.e.#inclu.pdfYou can use the below function for linear interpolation i.e.#inclu.pdf
You can use the below function for linear interpolation i.e.#inclu.pdfgulshan16175gs
 
These are the following tool to build a data model for an applicatio.pdf
These are the following tool to build a data model for an applicatio.pdfThese are the following tool to build a data model for an applicatio.pdf
These are the following tool to build a data model for an applicatio.pdfgulshan16175gs
 
Copper (II) Sulfate = CuSO4 Tin (IV) Oxide = SnO2.pdf
                     Copper (II) Sulfate = CuSO4 Tin (IV) Oxide = SnO2.pdf                     Copper (II) Sulfate = CuSO4 Tin (IV) Oxide = SnO2.pdf
Copper (II) Sulfate = CuSO4 Tin (IV) Oxide = SnO2.pdfgulshan16175gs
 
Water is a good solvent due to its polarity. The oxygen atom in wate.pdf
Water is a good solvent due to its polarity. The oxygen atom in wate.pdfWater is a good solvent due to its polarity. The oxygen atom in wate.pdf
Water is a good solvent due to its polarity. The oxygen atom in wate.pdfgulshan16175gs
 
V. The two types of larvae found in the life cycle of Diphyllobothri.pdf
V. The two types of larvae found in the life cycle of Diphyllobothri.pdfV. The two types of larvae found in the life cycle of Diphyllobothri.pdf
V. The two types of larvae found in the life cycle of Diphyllobothri.pdfgulshan16175gs
 
The tolerance has been given as +-0.05 inchSolutionThe tolera.pdf
The tolerance has been given as +-0.05 inchSolutionThe tolera.pdfThe tolerance has been given as +-0.05 inchSolutionThe tolera.pdf
The tolerance has been given as +-0.05 inchSolutionThe tolera.pdfgulshan16175gs
 
The voltmeter reading indicates that Zn is the negative electrode an.pdf
The voltmeter reading indicates that Zn is the negative electrode an.pdfThe voltmeter reading indicates that Zn is the negative electrode an.pdf
The voltmeter reading indicates that Zn is the negative electrode an.pdfgulshan16175gs
 
The foreign exchange market facilitates the exchange of Currencies. .pdf
The foreign exchange market facilitates the exchange of Currencies. .pdfThe foreign exchange market facilitates the exchange of Currencies. .pdf
The foreign exchange market facilitates the exchange of Currencies. .pdfgulshan16175gs
 
c. defendant that the complaint lacks true facts .pdf
                     c. defendant that the complaint lacks true facts .pdf                     c. defendant that the complaint lacks true facts .pdf
c. defendant that the complaint lacks true facts .pdfgulshan16175gs
 
bonde order of NO in nitrate 1.33 in nitrite is 1.pdf
                     bonde order of NO in nitrate 1.33 in nitrite is 1.pdf                     bonde order of NO in nitrate 1.33 in nitrite is 1.pdf
bonde order of NO in nitrate 1.33 in nitrite is 1.pdfgulshan16175gs
 
mean of sampling distribution = mean of the population from which th.pdf
mean of sampling distribution = mean of the population from which th.pdfmean of sampling distribution = mean of the population from which th.pdf
mean of sampling distribution = mean of the population from which th.pdfgulshan16175gs
 

More from gulshan16175gs (20)

2. The pressures of O2 and NO will be negligibleSolution 2. T.pdf
 2. The pressures of O2 and NO will be negligibleSolution 2. T.pdf 2. The pressures of O2 and NO will be negligibleSolution 2. T.pdf
2. The pressures of O2 and NO will be negligibleSolution 2. T.pdf
 
# Imports# Include your imports here, if any are used. import.pdf
 # Imports# Include your imports here, if any are used. import.pdf # Imports# Include your imports here, if any are used. import.pdf
# Imports# Include your imports here, if any are used. import.pdf
 
The OMe is a strong electron withdrawing group an.pdf
                     The OMe is a strong electron withdrawing group an.pdf                     The OMe is a strong electron withdrawing group an.pdf
The OMe is a strong electron withdrawing group an.pdf
 
O bears three lone pairs and is bound to a H, thu.pdf
                     O bears three lone pairs and is bound to a H, thu.pdf                     O bears three lone pairs and is bound to a H, thu.pdf
O bears three lone pairs and is bound to a H, thu.pdf
 
Nacl and H20 so, Salt & water .pdf
                     Nacl and H20 so, Salt & water                    .pdf                     Nacl and H20 so, Salt & water                    .pdf
Nacl and H20 so, Salt & water .pdf
 
In terms of ion charge, we notice that the charge.pdf
                     In terms of ion charge, we notice that the charge.pdf                     In terms of ion charge, we notice that the charge.pdf
In terms of ion charge, we notice that the charge.pdf
 
Here are four characteristics of acid a) A char.pdf
                     Here are four characteristics of acid  a) A char.pdf                     Here are four characteristics of acid  a) A char.pdf
Here are four characteristics of acid a) A char.pdf
 
Fe^3+(aq)Lewis acid H2O(l)Lewis baseereyedcommu .pdf
                     Fe^3+(aq)Lewis acid H2O(l)Lewis baseereyedcommu  .pdf                     Fe^3+(aq)Lewis acid H2O(l)Lewis baseereyedcommu  .pdf
Fe^3+(aq)Lewis acid H2O(l)Lewis baseereyedcommu .pdf
 
wrongSolutionwrong.pdf
wrongSolutionwrong.pdfwrongSolutionwrong.pdf
wrongSolutionwrong.pdf
 
You can use the below function for linear interpolation i.e.#inclu.pdf
You can use the below function for linear interpolation i.e.#inclu.pdfYou can use the below function for linear interpolation i.e.#inclu.pdf
You can use the below function for linear interpolation i.e.#inclu.pdf
 
These are the following tool to build a data model for an applicatio.pdf
These are the following tool to build a data model for an applicatio.pdfThese are the following tool to build a data model for an applicatio.pdf
These are the following tool to build a data model for an applicatio.pdf
 
Copper (II) Sulfate = CuSO4 Tin (IV) Oxide = SnO2.pdf
                     Copper (II) Sulfate = CuSO4 Tin (IV) Oxide = SnO2.pdf                     Copper (II) Sulfate = CuSO4 Tin (IV) Oxide = SnO2.pdf
Copper (II) Sulfate = CuSO4 Tin (IV) Oxide = SnO2.pdf
 
Water is a good solvent due to its polarity. The oxygen atom in wate.pdf
Water is a good solvent due to its polarity. The oxygen atom in wate.pdfWater is a good solvent due to its polarity. The oxygen atom in wate.pdf
Water is a good solvent due to its polarity. The oxygen atom in wate.pdf
 
V. The two types of larvae found in the life cycle of Diphyllobothri.pdf
V. The two types of larvae found in the life cycle of Diphyllobothri.pdfV. The two types of larvae found in the life cycle of Diphyllobothri.pdf
V. The two types of larvae found in the life cycle of Diphyllobothri.pdf
 
The tolerance has been given as +-0.05 inchSolutionThe tolera.pdf
The tolerance has been given as +-0.05 inchSolutionThe tolera.pdfThe tolerance has been given as +-0.05 inchSolutionThe tolera.pdf
The tolerance has been given as +-0.05 inchSolutionThe tolera.pdf
 
The voltmeter reading indicates that Zn is the negative electrode an.pdf
The voltmeter reading indicates that Zn is the negative electrode an.pdfThe voltmeter reading indicates that Zn is the negative electrode an.pdf
The voltmeter reading indicates that Zn is the negative electrode an.pdf
 
The foreign exchange market facilitates the exchange of Currencies. .pdf
The foreign exchange market facilitates the exchange of Currencies. .pdfThe foreign exchange market facilitates the exchange of Currencies. .pdf
The foreign exchange market facilitates the exchange of Currencies. .pdf
 
c. defendant that the complaint lacks true facts .pdf
                     c. defendant that the complaint lacks true facts .pdf                     c. defendant that the complaint lacks true facts .pdf
c. defendant that the complaint lacks true facts .pdf
 
bonde order of NO in nitrate 1.33 in nitrite is 1.pdf
                     bonde order of NO in nitrate 1.33 in nitrite is 1.pdf                     bonde order of NO in nitrate 1.33 in nitrite is 1.pdf
bonde order of NO in nitrate 1.33 in nitrite is 1.pdf
 
mean of sampling distribution = mean of the population from which th.pdf
mean of sampling distribution = mean of the population from which th.pdfmean of sampling distribution = mean of the population from which th.pdf
mean of sampling distribution = mean of the population from which th.pdf
 

Recently uploaded

Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 

Recently uploaded (20)

Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 

(deftemp Animal   (slot loc      (default greencouch))   (slot.pdf

  • 1. (deftemp Animal (slot loc (default greencouch)) (slot on-top-of (default roof)) (slot hold (default nothing))) (deftemp thing (slot name (default NONE)) (slot loc (default NONE)) (slot on-top-of (default roof)) (slot mass (default light weight))) (deftemp chest (slot name (default NONE)) (slot contents (default NONE)) (slot unlocked-by (default NONE))) (deftemp goal-was (slot act (default NONE)) (multislot args)) (defrule hold chest to get of roof "" (goal-was (act unlock) (args ?chest)) (thing (name ?chest) (on-top-of ~roof) (mass light weight)) (Animal (hold ~?chest)) (not (goal-was (act hold) (args ?chest)))
  • 2. => (assert (goal-was (act hold) (args ?chest)))) (defrule put-chest-on-roof "" (goal-was (act unlock) (args ?chest)) ?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold ?chest)) ?thing <- (thing (name ?chest)) => (printout t "Animal throws the " ?chest " off the " ?on " onto the roof." crlf) (modify ?Animal (hold blank)) (modify ?thing (loc ?place) (on-top-of roof))) (defrule get-key-to-unlock "" (goal-was (act unlock) (args ?obj)) (thing (name ?obj) (on-top-of roof)) (chest (name ?obj) (unlocked-by ?key)) (Animal (hold ~?key)) (not (goal-was (act hold) (args ?key))) => (assert (goal-was (act hold) (args ?key)))) (defrule move-to-chest-with-key "" (goal-was (act unlock) (args ?chest)) (Animal (loc ?mplace) (hold ?key)) (thing (name ?chest) (loc ?cplace&~?mplace) (on-top-of roof)) (chest (name ?chest) (unlocked-by ?key)) (not (goal-was (act walk-to) (args ?cplace))) => (assert (goal-was (act walk-to) (args ?cplace)))) (defrule unlock-chest-with-key "" ?goal <- (goal-was (act unlock) (args ?name)) ?chest <- (chest (name ?name) (contents ?contents) (unlocked-by ?key)) (thing (name ?name) (loc ?place) (on-top-of ?on)) (Animal (loc ?place) (on-top-of ?on) (hold ?key)) => (printout t "Animal opens the " ?name " with the " ?key " revealing the " ?contents "." crlf) (modify ?chest (contents nothing))
  • 3. (assert (thing (name ?contents) (loc ?place) (on-top-of ?name))) (retract ?goal)) ;;;********************* ;;;* HOLD OBJECT RULES * ;;;********************* (defrule unlock-chest-to-hold-object "" (goal-was (act hold) (args ?obj)) (chest (name ?chest) (contents ?obj)) (not (goal-was (act unlock) (args ?chest))) => (assert (goal-was (act unlock) (args ?chest)))) (defrule use-ladder-to-hold "" (goal-was (act hold) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ceiling) (mass light weight)) (not (thing (name ladder) (loc ?place))) (not (goal-was (act move) (args ladder ?place))) => (assert (goal-was (act move) (args ladder ?place)))) (defrule climb-ladder-to-hold "" (goal-was (act hold) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ceiling) (mass light weight)) (thing (name ladder) (loc ?place) (on-top-of roof)) (Animal (on-top-of ~ladder)) (not (goal-was (act on) (args ladder))) => (assert (goal-was (act on) (args ladder)))) (defrule grab-object-from-ladder "" ?goal <- (goal-was (act hold) (args ?name)) ?thing <- (thing (name ?name) (loc ?place) (on-top-of ceiling) (mass light weight)) (thing (name ladder) (loc ?place)) ?Animal <- (Animal (loc ?place) (on-top-of ladder) (hold blank)) => (printout t "Animal grabs the " ?name "." crlf) (modify ?thing (loc held) (on-top-of held)) (modify ?Animal (hold ?name))
  • 4. (retract ?goal)) (defrule climb-to-hold "" (goal-was (act hold) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ?on&~ceiling) (mass light weight)) (Animal (loc ?place) (on-top-of ~?on)) (not (goal-was (act on) (args ?on))) => (assert (goal-was (act on) (args ?on)))) (defrule walk-to-hold "" (goal-was (act hold) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ~ceiling) (mass light weight)) (Animal (loc ~?place)) (not (goal-was (act walk-to) (args ?place))) => (assert (goal-was (act walk-to) (args ?place)))) (defrule drop-to-hold "" (goal-was (act hold) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ?on) (mass light weight)) (Animal (loc ?place) (on-top-of ?on) (hold ~blank)) (not (goal-was (act hold) (args blank))) => (assert (goal-was (act hold) (args blank)))) (defrule grab-object "" ?goal <- (goal-was (act hold) (args ?name)) ?thing <- (thing (name ?name) (loc ?place) (on-top-of ?on) (mass light weight)) ?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold blank)) => (printout t "Animal grabs the " ?name "." crlf) (modify ?thing (loc held) (on-top-of held)) (modify ?Animal (hold ?name)) (retract ?goal)) (defrule drop-object "" ?goal <- (goal-was (act hold) (args blank)) ?Animal <- (Animal (loc ?place) (on-top-of ?on)
  • 5. (hold ?name&~blank)) ?thing <- (thing (name ?name)) => (printout t "Animal drops the " ?name "." crlf) (modify ?Animal (hold blank)) (modify ?thing (loc ?place) (on-top-of ?on)) (retract ?goal)) ;;;********************* ;;;* MOVE OBJECT RULES * ;;;********************* (defrule unlock-chest-to-move-object "" (goal-was (act move) (args ?obj ?)) (chest (name ?chest) (contents ?obj)) (not (goal-was (act unlock) (args ?chest))) => (assert (goal-was (act unlock) (args ?chest)))) (defrule hold-object-to-move "" (goal-was (act move) (args ?obj ?place)) (thing (name ?obj) (loc ~?place) (mass light weight)) (Animal (hold ~?obj)) (not (goal-was (act hold) (args ?obj))) => (assert (goal-was (act hold) (args ?obj)))) (defrule move-object-to-place "" (goal-was (act move) (args ?obj ?place)) (Animal (loc ~?place) (hold ?obj)) (not (goal-was (act walk-to) (args ?place))) => (assert (goal-was (act walk-to) (args ?place)))) (defrule drop-object-once-moved "" ?goal <- (goal-was (act move) (args ?name ?place)) ?Animal <- (Animal (loc ?place) (hold ?obj)) ?thing <- (thing (name ?name) (mass light weight)) => (printout t "Animal drops the " ?name "." crlf) (modify ?Animal (hold blank))
  • 6. (modify ?thing (loc ?place) (on-top-of roof)) (retract ?goal)) (defrule already-moved-object "" ?goal <- (goal-was (act move) (args ?obj ?place)) (thing (name ?obj) (loc ?place)) => (retract ?goal)) ;;;*********************** ;;;* WALK TO PLACE RULES * ;;;*********************** (defrule already-at-place "" ?goal <- (goal-was (act walk-to) (args ?place)) (Animal (loc ?place)) => (retract ?goal)) (defrule get-on-roof-to-walk "" (goal-was (act walk-to) (args ?place)) (Animal (loc ~?place) (on-top-of ~roof)) (not (goal-was (act on) (args roof))) => (assert (goal-was (act on) (args roof)))) (defrule walk-hold-nothing "" ?goal <- (goal-was (act walk-to) (args ?place)) ?Animal <- (Animal (loc ~?place) (on-top-of roof) (hold blank)) => (printout t "Animal walks to " ?place "." crlf) (modify ?Animal (loc ?place)) (retract ?goal)) (defrule walk-hold-object "" ?goal <- (goal-was (act walk-to) (args ?place)) ?Animal <- (Animal (loc ~?place) (on-top-of roof) (hold ?obj&~blank)) => (printout t "Animal walks to " ?place " hold the " ?obj "." crlf) (modify ?Animal (loc ?place)) (retract ?goal)) ;;;***********************
  • 7. ;;;* GET ON OBJECT RULES * ;;;*********************** (defrule jump-onto-roof "" ?goal <- (goal-was (act on) (args roof)) ?Animal <- (Animal (on-top-of ?on&~roof)) => (printout t "Animal jumps off the " ?on " onto the roof." crlf) (modify ?Animal (on-top-of roof)) (retract ?goal)) (defrule walk-to-place-to-climb "" (goal-was (act on) (args ?obj)) (thing (name ?obj) (loc ?place)) (Animal (loc ~?place)) (not (goal-was (act walk-to) (args ?place))) => (assert (goal-was (act walk-to) (args ?place)))) (defrule drop-to-climb "" (goal-was (act on) (args ?obj)) (thing (name ?obj) (loc ?place)) (Animal (loc ?place) (hold ~blank)) (not (goal-was (act hold) (args blank))) => (assert (goal-was (act hold) (args blank)))) (defrule climb-indirectly "" (goal-was (act on) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ?on)) (Animal (loc ?place) (on-top-of ~?on&~?obj) (hold blank)) (not (goal-was (act on) (args ?on))) => (assert (goal-was (act on) (args ?on)))) (defrule climb-directly "" ?goal <- (goal-was (act on) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ?on)) ?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold blank)) => (printout t "Animal climbs onto the " ?obj "." crlf)
  • 8. (modify ?Animal (on-top-of ?obj)) (retract ?goal)) (defrule already-on-object "" ?goal <- (goal-was (act on) (args ?obj)) (Animal (on-top-of ?obj)) => (retract ?goal)) ;;;******************** ;;;* EAT OBJECT RULES * ;;;******************** (defrule hold-to-eat "" (goal-was (act eat) (args ?obj)) (Animal (hold ~?obj)) (not (goal-was (act hold) (args ?obj))) => (assert (goal-was (act hold) (args ?obj)))) (defrule satisfy-hunger "" ?goal <- (goal-was (act eat) (args ?name)) ?Animal <- (Animal (hold ?name)) ?thing <- (thing (name ?name)) => (printout t "Animal eats the " ?name "." crlf) (modify ?Animal (hold blank)) (retract ?goal ?thing)) ;;;********************** ;;;* INITIAL STATE * ;;;********************** (deffacts startup "" (Animal (loc t5-7) (on-top-of greencouch) (hold blank)) (thing (name greencouch) (loc t5-7) (mass heavy)) (thing (name red-couch) (loc t2-2) (mass heavy)) (thing (name big-pillow) (loc t2-2) (on-top-of red-couch)) (thing (name red-chest) (loc t2-2) (on-top-of big-pillow)) (chest (name red-chest) (contents ladder) (unlocked-by red-key)) (thing (name blue-chest) (loc t7-7) (on-top-of ceiling)) (chest (name blue-chest) (contents bananas) (unlocked-by blue-key))
  • 9. (thing (name blue-couch) (loc t8-8) (mass heavy)) (thing (name green-chest) (loc t8-8) (on-top-of ceiling)) (chest (name green-chest) (contents blue-key) (unlocked-by red-key)) (thing (name red-key) (loc t1-3)) (goal-was (act eat) (args bananas))) Solution (deftemp Animal (slot loc (default greencouch)) (slot on-top-of (default roof)) (slot hold (default nothing))) (deftemp thing (slot name (default NONE)) (slot loc (default NONE)) (slot on-top-of (default roof)) (slot mass (default light weight))) (deftemp chest (slot name (default NONE)) (slot contents (default NONE)) (slot unlocked-by (default NONE))) (deftemp goal-was (slot act (default NONE))
  • 10. (multislot args)) (defrule hold chest to get of roof "" (goal-was (act unlock) (args ?chest)) (thing (name ?chest) (on-top-of ~roof) (mass light weight)) (Animal (hold ~?chest)) (not (goal-was (act hold) (args ?chest))) => (assert (goal-was (act hold) (args ?chest)))) (defrule put-chest-on-roof "" (goal-was (act unlock) (args ?chest)) ?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold ?chest)) ?thing <- (thing (name ?chest)) => (printout t "Animal throws the " ?chest " off the " ?on " onto the roof." crlf) (modify ?Animal (hold blank)) (modify ?thing (loc ?place) (on-top-of roof))) (defrule get-key-to-unlock "" (goal-was (act unlock) (args ?obj)) (thing (name ?obj) (on-top-of roof)) (chest (name ?obj) (unlocked-by ?key)) (Animal (hold ~?key)) (not (goal-was (act hold) (args ?key))) => (assert (goal-was (act hold) (args ?key)))) (defrule move-to-chest-with-key "" (goal-was (act unlock) (args ?chest)) (Animal (loc ?mplace) (hold ?key)) (thing (name ?chest) (loc ?cplace&~?mplace) (on-top-of roof)) (chest (name ?chest) (unlocked-by ?key)) (not (goal-was (act walk-to) (args ?cplace))) => (assert (goal-was (act walk-to) (args ?cplace)))) (defrule unlock-chest-with-key "" ?goal <- (goal-was (act unlock) (args ?name))
  • 11. ?chest <- (chest (name ?name) (contents ?contents) (unlocked-by ?key)) (thing (name ?name) (loc ?place) (on-top-of ?on)) (Animal (loc ?place) (on-top-of ?on) (hold ?key)) => (printout t "Animal opens the " ?name " with the " ?key " revealing the " ?contents "." crlf) (modify ?chest (contents nothing)) (assert (thing (name ?contents) (loc ?place) (on-top-of ?name))) (retract ?goal)) ;;;********************* ;;;* HOLD OBJECT RULES * ;;;********************* (defrule unlock-chest-to-hold-object "" (goal-was (act hold) (args ?obj)) (chest (name ?chest) (contents ?obj)) (not (goal-was (act unlock) (args ?chest))) => (assert (goal-was (act unlock) (args ?chest)))) (defrule use-ladder-to-hold "" (goal-was (act hold) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ceiling) (mass light weight)) (not (thing (name ladder) (loc ?place))) (not (goal-was (act move) (args ladder ?place))) => (assert (goal-was (act move) (args ladder ?place)))) (defrule climb-ladder-to-hold "" (goal-was (act hold) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ceiling) (mass light weight)) (thing (name ladder) (loc ?place) (on-top-of roof)) (Animal (on-top-of ~ladder)) (not (goal-was (act on) (args ladder))) => (assert (goal-was (act on) (args ladder)))) (defrule grab-object-from-ladder "" ?goal <- (goal-was (act hold) (args ?name)) ?thing <- (thing (name ?name) (loc ?place)
  • 12. (on-top-of ceiling) (mass light weight)) (thing (name ladder) (loc ?place)) ?Animal <- (Animal (loc ?place) (on-top-of ladder) (hold blank)) => (printout t "Animal grabs the " ?name "." crlf) (modify ?thing (loc held) (on-top-of held)) (modify ?Animal (hold ?name)) (retract ?goal)) (defrule climb-to-hold "" (goal-was (act hold) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ?on&~ceiling) (mass light weight)) (Animal (loc ?place) (on-top-of ~?on)) (not (goal-was (act on) (args ?on))) => (assert (goal-was (act on) (args ?on)))) (defrule walk-to-hold "" (goal-was (act hold) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ~ceiling) (mass light weight)) (Animal (loc ~?place)) (not (goal-was (act walk-to) (args ?place))) => (assert (goal-was (act walk-to) (args ?place)))) (defrule drop-to-hold "" (goal-was (act hold) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ?on) (mass light weight)) (Animal (loc ?place) (on-top-of ?on) (hold ~blank)) (not (goal-was (act hold) (args blank))) => (assert (goal-was (act hold) (args blank)))) (defrule grab-object "" ?goal <- (goal-was (act hold) (args ?name)) ?thing <- (thing (name ?name) (loc ?place) (on-top-of ?on) (mass light weight)) ?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold blank)) => (printout t "Animal grabs the " ?name "." crlf)
  • 13. (modify ?thing (loc held) (on-top-of held)) (modify ?Animal (hold ?name)) (retract ?goal)) (defrule drop-object "" ?goal <- (goal-was (act hold) (args blank)) ?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold ?name&~blank)) ?thing <- (thing (name ?name)) => (printout t "Animal drops the " ?name "." crlf) (modify ?Animal (hold blank)) (modify ?thing (loc ?place) (on-top-of ?on)) (retract ?goal)) ;;;********************* ;;;* MOVE OBJECT RULES * ;;;********************* (defrule unlock-chest-to-move-object "" (goal-was (act move) (args ?obj ?)) (chest (name ?chest) (contents ?obj)) (not (goal-was (act unlock) (args ?chest))) => (assert (goal-was (act unlock) (args ?chest)))) (defrule hold-object-to-move "" (goal-was (act move) (args ?obj ?place)) (thing (name ?obj) (loc ~?place) (mass light weight)) (Animal (hold ~?obj)) (not (goal-was (act hold) (args ?obj))) => (assert (goal-was (act hold) (args ?obj)))) (defrule move-object-to-place "" (goal-was (act move) (args ?obj ?place)) (Animal (loc ~?place) (hold ?obj)) (not (goal-was (act walk-to) (args ?place))) => (assert (goal-was (act walk-to) (args ?place))))
  • 14. (defrule drop-object-once-moved "" ?goal <- (goal-was (act move) (args ?name ?place)) ?Animal <- (Animal (loc ?place) (hold ?obj)) ?thing <- (thing (name ?name) (mass light weight)) => (printout t "Animal drops the " ?name "." crlf) (modify ?Animal (hold blank)) (modify ?thing (loc ?place) (on-top-of roof)) (retract ?goal)) (defrule already-moved-object "" ?goal <- (goal-was (act move) (args ?obj ?place)) (thing (name ?obj) (loc ?place)) => (retract ?goal)) ;;;*********************** ;;;* WALK TO PLACE RULES * ;;;*********************** (defrule already-at-place "" ?goal <- (goal-was (act walk-to) (args ?place)) (Animal (loc ?place)) => (retract ?goal)) (defrule get-on-roof-to-walk "" (goal-was (act walk-to) (args ?place)) (Animal (loc ~?place) (on-top-of ~roof)) (not (goal-was (act on) (args roof))) => (assert (goal-was (act on) (args roof)))) (defrule walk-hold-nothing "" ?goal <- (goal-was (act walk-to) (args ?place)) ?Animal <- (Animal (loc ~?place) (on-top-of roof) (hold blank)) => (printout t "Animal walks to " ?place "." crlf) (modify ?Animal (loc ?place)) (retract ?goal)) (defrule walk-hold-object ""
  • 15. ?goal <- (goal-was (act walk-to) (args ?place)) ?Animal <- (Animal (loc ~?place) (on-top-of roof) (hold ?obj&~blank)) => (printout t "Animal walks to " ?place " hold the " ?obj "." crlf) (modify ?Animal (loc ?place)) (retract ?goal)) ;;;*********************** ;;;* GET ON OBJECT RULES * ;;;*********************** (defrule jump-onto-roof "" ?goal <- (goal-was (act on) (args roof)) ?Animal <- (Animal (on-top-of ?on&~roof)) => (printout t "Animal jumps off the " ?on " onto the roof." crlf) (modify ?Animal (on-top-of roof)) (retract ?goal)) (defrule walk-to-place-to-climb "" (goal-was (act on) (args ?obj)) (thing (name ?obj) (loc ?place)) (Animal (loc ~?place)) (not (goal-was (act walk-to) (args ?place))) => (assert (goal-was (act walk-to) (args ?place)))) (defrule drop-to-climb "" (goal-was (act on) (args ?obj)) (thing (name ?obj) (loc ?place)) (Animal (loc ?place) (hold ~blank)) (not (goal-was (act hold) (args blank))) => (assert (goal-was (act hold) (args blank)))) (defrule climb-indirectly "" (goal-was (act on) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ?on)) (Animal (loc ?place) (on-top-of ~?on&~?obj) (hold blank)) (not (goal-was (act on) (args ?on))) =>
  • 16. (assert (goal-was (act on) (args ?on)))) (defrule climb-directly "" ?goal <- (goal-was (act on) (args ?obj)) (thing (name ?obj) (loc ?place) (on-top-of ?on)) ?Animal <- (Animal (loc ?place) (on-top-of ?on) (hold blank)) => (printout t "Animal climbs onto the " ?obj "." crlf) (modify ?Animal (on-top-of ?obj)) (retract ?goal)) (defrule already-on-object "" ?goal <- (goal-was (act on) (args ?obj)) (Animal (on-top-of ?obj)) => (retract ?goal)) ;;;******************** ;;;* EAT OBJECT RULES * ;;;******************** (defrule hold-to-eat "" (goal-was (act eat) (args ?obj)) (Animal (hold ~?obj)) (not (goal-was (act hold) (args ?obj))) => (assert (goal-was (act hold) (args ?obj)))) (defrule satisfy-hunger "" ?goal <- (goal-was (act eat) (args ?name)) ?Animal <- (Animal (hold ?name)) ?thing <- (thing (name ?name)) => (printout t "Animal eats the " ?name "." crlf) (modify ?Animal (hold blank)) (retract ?goal ?thing)) ;;;********************** ;;;* INITIAL STATE * ;;;********************** (deffacts startup "" (Animal (loc t5-7) (on-top-of greencouch) (hold blank))
  • 17. (thing (name greencouch) (loc t5-7) (mass heavy)) (thing (name red-couch) (loc t2-2) (mass heavy)) (thing (name big-pillow) (loc t2-2) (on-top-of red-couch)) (thing (name red-chest) (loc t2-2) (on-top-of big-pillow)) (chest (name red-chest) (contents ladder) (unlocked-by red-key)) (thing (name blue-chest) (loc t7-7) (on-top-of ceiling)) (chest (name blue-chest) (contents bananas) (unlocked-by blue-key)) (thing (name blue-couch) (loc t8-8) (mass heavy)) (thing (name green-chest) (loc t8-8) (on-top-of ceiling)) (chest (name green-chest) (contents blue-key) (unlocked-by red-key)) (thing (name red-key) (loc t1-3)) (goal-was (act eat) (args bananas)))