; ---------------------------------------------------
; *** Card-Pairs  V1.0  CHESS COMPARISONs         ***
; *** BUILT UPON Karl Scherer's Pairs.zrf (v1.1)  ***
; * *                                             * *
; * * implemented by K. Franklin,  Nov. 2003      * *
; * * e-mail address: kenf@ica.net                * *
; ---------------------------------------------------
; Copyright 1998-2000 Zillions Development (v1.31)


;=====================================================================================
;============================= Compare CHESS Ranks ===================================
;=====================================================================================
(define CHSSP1 ; compare selected items
 (
   to
   (verify (piece? $1)) 

   mark x
   (while (or empty? (piece? button)) x)

   (if (or (piece? wht1)(piece? blk1) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CHSSP2 ; compare selected items
 (
   to
   (verify (piece? $1)) 

   mark x
   (while (or empty? (piece? button)) x)

   (if (or (piece? wht2)(piece? blk2) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CHSSP3 ; compare selected items
 (
   to
   (verify (piece? $1)) 

   mark x
   (while (or empty? (piece? button)) x)

   (if (or (piece? wht3)(piece? blk3) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CHSSP4 ; compare selected items
 (
   to
   (verify (piece? $1)) 

   mark x
   (while (or empty? (piece? button)) x)

   (if (or (piece? wht4)(piece? blk4) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CHSSP5 ; compare selected items
 (
   to
   (verify (piece? $1)) 

   mark x
   (while (or empty? (piece? button)) x)

   (if (or (piece? wht5)(piece? blk5) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CHSSP6 ; compare selected items
 (
   to
   (verify (piece? $1)) 

   mark x
   (while (or empty? (piece? button)) x)

   (if (or (piece? wht6)(piece? blk6) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CHSSP7 ; compare selected items
 (
   to
   (verify (piece? $1)) 

   mark x
   (while (or empty? (piece? button)) x)

   (if (or (piece? wht7)(piece? blk7) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CHSSP8 ; compare selected items
 (
   to
   (verify (piece? $1)) 

   mark x
   (while (or empty? (piece? button)) x)

   (if (or (piece? wht8)(piece? blk8) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CHSSP9 ; compare selected items
 (
   to
   (verify (piece? $1)) 

   mark x
   (while (or empty? (piece? button)) x)

   (if (or (piece? wht9)(piece? blk9) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)


;=====================================================================================
;============================= Compare SAME CHESS Cards ==============================
;=====================================================================================
(define CHSSP-SM ; compare selected items
 (
   to
   (verify (piece? $1)) 

   mark x
   (while (or empty? (piece? button)) x)

   (if (piece? $1)
	(MatchedUP) ;New Feature
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP) ;New Feature
   add
 )
)
