Advertisement
Guest User

Untitled

a guest
May 18th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (def world3
  2.   '#{(connects A1 A2)
  3.      (connects A2 A1)
  4.      (connects A2 A3)
  5.      (connects A3 A2)
  6.      (connects B1 B2)
  7.      (connects B2 B3)
  8.      (connects B3 B2)
  9.      (connects B2 B1)
  10.      (above B1 A3)
  11.      (above C1 B3)
  12.      (on ball C1)
  13.      (on ball2 B2)
  14.      (platform B1)
  15.      (platform B2)
  16.      (platform B3)
  17.      (platform C1)
  18.      (climbable B1)
  19.      (climbable C1)
  20.      (manipulable ball)
  21.      (manipulable ball2)
  22.      (agent R)
  23.      })
  24.  
  25. (def state3
  26.   '#{(at R A1)
  27.      (holds R nil) ;Would just return nil without this
  28.      })
  29.  
  30. (def ops3
  31.   '{climb-on {:pre ((agent ?agent)      ; FIRST VERSION OF CLIMB ON
  32.                      (at ?agent ?place)
  33.                      (above ?platform ?place)
  34.                      (climbable ?platform)
  35.                      (holds ?agent nil)) ;This came later when we thought about the platform problem
  36.  
  37.               :del ((at ?agent ?place))
  38.               :add ((at ?agent ?platform))
  39.               :txt (climb on ?platform)
  40.               :cmd [on ?agent ?platform]
  41.               }
  42.  
  43.     pick-off {:pre ((agent ?agent)
  44.                      (manipulable ?obj)
  45.                      (platform ?platform)
  46.                      (at ?agent ?platform)
  47.                      (on ?obj ?platform)
  48.                      (holds ?agent nil))
  49.  
  50.               :add ((holds ?agent ?obj))
  51.               :del ((on ?obj ?platform)
  52.                      (holds ?agent nil))
  53.               :txt ((Pick off ?obj from ?platform))
  54.               :cmd [Pick-off ?obj from ?platform]
  55.               }
  56.  
  57.  
  58.     move     {:pre ((agent ?agent)
  59.                      (at ?agent ?p1)
  60.                      (connects ?p1 ?p2))
  61.  
  62.               :add ((at ?agent ?p2))
  63.               :del ((at ?agent ?p1))
  64.               :txt ((move from ?p1 to ?p2))
  65.               :cmd [move ?p1 to ?p2]
  66.               }
  67.  
  68.     climb-off {:pre ((agent ?agent)
  69.                       (at ?agent ?platform)
  70.                       (above ?platform ?place)
  71.                       (holds ?agent nil))
  72.                :del ((at ?agent ?platform))
  73.                :add ((at ?agent ?place))
  74.                :txt (climb-off from ?platform)
  75.                :cmd [climb-off from ?platform]
  76.                }
  77.  
  78.     drop-on {:pre  ((agent ?agent)
  79.                      (platform ?platform)
  80.                      (at ?agent ?platform)
  81.                      (:not (holds ?agent nil))
  82.                      (holds ?agent ?obj))
  83.  
  84.              :add ((holds ?agent nil)
  85.                     (on ?obj ?platform))
  86.              :del ((holds ?agent ?obj))
  87.              :txt ((drop-on ?obj on ?platform))
  88.              :cmd [drop-on ?obj ?platform]
  89.              }
  90.  
  91.     drop-from-platform {:pre  ((agent ?agent)
  92.                                 (platform ?platform)
  93.                                 (at ?agent ?platform)
  94.                                 (above ?platform ?place)
  95.                                 (:not (holds ?agent nil))
  96.                                 (holds ?agent ?obj))
  97.                         :add ((holds ?agent nil)
  98.                                (on ?obj ?place))
  99.                         :del ((holds ?agent ?obj))
  100.                         :txt ((Drop-from ?obj to ?place))
  101.                         :cmd [drop-from ?obj to ?place]
  102.                         }
  103.  
  104.  
  105.     drop     {:pre ((agent ?agent)
  106.                      (at ?agent ?place)
  107.                      (:not (holds ?agent nil)) ;Agent would drop object "?obj" when holding nil so this line works around that
  108.                      (holds ?agent ?obj))
  109.  
  110.               :add ((holds ?agent nil)
  111.                      (on ?obj ?place))
  112.               :del ((holds ?agent ?obj))
  113.               :txt ((Drop ?obj at ?place))
  114.               :cmd [drop ?obj at ?place]
  115.               }
  116.  
  117.     pickup   {:pre ((agent ?agent)
  118.                      (manipulable ?obj)
  119.                      (at ?agent ?place)
  120.                      (on ?obj ?place)
  121.                      (holds ?agent nil))
  122.  
  123.               :add ((holds ?agent ?obj))
  124.               :del ((on ?obj ?place)
  125.                      (holds ?agent nil))
  126.               :txt ((pickup ?obj at ?place))
  127.               :cmd [pickup ?obj from ?place]
  128.               }
  129.     })
  130.  
  131.  
  132. ; (ops-search state3 '((at R A1)(holds R ball)) ops3 :world world3)
  133. ; (ops-search state3 '((at R A2) (on ball B2) (holds R nil)) ops3 :world world3)
  134. ; (ops-search state3 '((at R A2) (on ball B2) (on ball2 A3) (holds R nil)) ops3 :world world3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement