courses:knowledge_representation_and_artificial_intelligence_systems:lab4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
courses:knowledge_representation_and_artificial_intelligence_systems:lab4 [2019/07/24 12:19]
andrey.suchkov [Общие сведения]
courses:knowledge_representation_and_artificial_intelligence_systems:lab4 [2022/12/10 09:08] (current)
Line 17: Line 17:
   (slot peasant-location (type SYMBOL) (allowed-symbols shore-1 shore-2))   (slot peasant-location (type SYMBOL) (allowed-symbols shore-1 shore-2))
   (slot wolf-location (type SYMBOL) (allowed-symbols shore-1 shore-2))   (slot wolf-location (type SYMBOL) (allowed-symbols shore-1 shore-2))
-  ​(slot goat-locatio ​(type SYMBOL) (allowed-symbols shore-1 shore-2))+  (slot goat-location ​(type SYMBOL) (allowed-symbols shore-1 shore-2))
   (slot cabbage-location (type SYMBOL) (allowed-symbols shore-1 shore-2))   (slot cabbage-location (type SYMBOL) (allowed-symbols shore-1 shore-2))
   (slot parent (type FACT-ADDRESS SYMBOL) (allowed-symbols no-parent))   (slot parent (type FACT-ADDRESS SYMBOL) (allowed-symbols no-parent))
Line 46: Line 46:
 (defrule move-with-wolf "​Правило перемещения с волком"​ (defrule move-with-wolf "​Правило перемещения с волком"​
   ?node <- (status (search-depth ?num)     ; фиксация адреса текущей вершины и ее глубины   ?node <- (status (search-depth ?num)     ; фиксация адреса текущей вершины и ее глубины
-                   ​(peasant-location ?fs)  ; фиксация текущего местонахождения крестьянина +                   ​(peasant-location ?ps)  ; фиксация текущего местонахождения крестьянина 
-                   ​(wolf-location ?fs))    ; волк на том же берегу,​ что и крестьянина +                   ​(wolf-location ?ps))    ; волк на том же берегу,​ что и крестьянина 
-  (opposite-of ?fs ?ns)  ; связывание значения противоположного берега+  (opposite-of ?ps ?ns)  ; связывание значения противоположного берега
 => =>
   (duplicate ?node              ; создать новую вершину дублированием   (duplicate ?node              ; создать новую вершину дублированием
Line 148: Line 148:
        else (printout t "​Peasant moves with " ?thing " to " ?shore "​."​ t))        else (printout t "​Peasant moves with " ?thing " to " ?shore "​."​ t))
     (if (eq ?shore shore-1) ​        ; Если ?shore = shore-1     (if (eq ?shore shore-1) ​        ; Если ?shore = shore-1
-       then (bind ?shore shore-2) ​  ;?​shore = shore-2 +       then (bind ?shore shore-2) ​  ; ?shore = shore-2 
-       else (bind ?shore shore-1)) ​ ;?shore = shore-1+       else (bind ?shore shore-1)) ​ ; ?shore = shore-1
     (bind ?i (+ 1 ?​i)))) ​ ; ?i = ?i + 1     (bind ?i (+ 1 ?​i)))) ​ ; ?i = ?i + 1
 </​code>​ </​code>​
courses/knowledge_representation_and_artificial_intelligence_systems/lab4.1563970762.txt.gz · Last modified: 2022/12/10 09:08 (external edit)