Loading ...
Sorry, an error occurred while loading the content.

79question about CLIPS

Expand Messages
  • Alberto Vera
    Sep 10, 2002
    • 0 Attachment

      hello
      I copied this example of a book about CLIPS
      This program has "blocks" and the objective is to put the block C over the block E
      Does anybody know when it stop? The objective is (objetivo (poner C)(encima-de E)) but i don't
      understand when it stop.
      Could you help me, please?

      Thanks a lot


      it's the program:

      //start
      (deftemplate objetivo(slot poner)(slot encima-de))
      (deffacts estado-inicial
         (pila A B C)
         (pila D E F)
         (objetivo (poner C)(encima-de E))
         (pila)
      )

      (defrule mover-directamente
         ?objetivo <-(objetivo (poner ?bloque1)(encima-de ?bloque2))
         ?pila-1 <- (pila ?bloque1 $?resto1)
         ?pila-2 <- (pila ?bloque2 $?resto2)
         =>
         (retract ?objetivo ?pila-1 ?pila-2)
         (assert (pila $?resto1))
         (assert (pila ?bloque1 ?bloque2 $?resto2))
         (printout t ?bloque1 " puesto encima de " ?bloque2 "." crlf)
      )

      (defrule poner-en-el-piso
         ?objetivo <- (objetivo (poner ?bloque1) (encima-de piso))
         ?pila-1 <-(pila ?bloque1 $?resto)
         =>
         (retract ?objetivo ?pila-1)
         (assert (pila ?bloque1))
         (assert (pila $?resto))
         (printout t ?bloque1 " puesto en el piso " crlf)
      )

      (defrule despejar-bloque-superior
         (objetivo (poner ?bloque1))
         (pila ?arriba $? ?bloque1 $?)
         =>
         (assert (objetivo (poner ?arriba)(encima-de piso)))
      )

      (defrule despejar-bloque-inferior
         (objetivo (encima-de ?bloque1))
         (pila ?arriba $? ?bloque1 $?)
         =>
         (assert (objetivo (poner ?arriba)(encima-de piso)))
      )
      //end


      Yahoo! Messenger
      Nueva versión: Webcam, voz, y mucho más ¡Gratis!
    • Show all 3 messages in this topic