Hi, I4m trying to program the Chess Knight movement. I would
like to simulate when chess knight kills pawns.

        It4s difficult to me get when knight kills all the pawns and
finish the game. I have tried with a multislot pawns and it is deleted
(one object of multislot) when knight kills pawn. But it doesn4t work.

        Anybody could help me.

        Thanks.
        
        I have got next code:

        

(defmodule MAIN 
  (export deftemplate caballo)
        
  (export deftemplate peon))


   
;;;***************************
;;;*  chess set              *
;;;***************************


(deftemplate MAIN::caballo 
(slot parent (type FACT-ADDRESS SYMBOL))                         
(multislot peones) 
(slot x (type INTEGER) (range 1 8))
(slot y (type INTEGER) (range 1 8))
) 

(deftemplate MAIN::peon 
(slot x (type INTEGER) (range 1 8))
(slot y (type INTEGER) (range 1 8)) 
) 

;;;**********
;;;* Rules *
;;;**********


;Come peon 
(defrule comePeon 
?p <- (peon (x ?x)(y ?y)) 
?c <- (caballo (x ?x)(y ?y)(peones $?peones&:(member$ ?p ?peones))) 
=> 
(bind ?index (member$ ?p ?peones)) 
(modify ?c(peones (delete$ ?peones ?index ?index))) 
) 


;;;*********************************
;;;* Solucion                      *
;;;*********************************

(defmodule SOLUTION 
  
  (import MAIN deftemplate caballo)
        (import MAIN deftemplate peon))

;Solucion encontrada 
(defrule SOLUTION::solucion 
(salience 1000) 
?c <- (caballo (peones $?peones&:(= (length$ ?peones) 0))) 
=> 
 (store "SOLUCION" ?c) 
 (halt) 
)

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to