; ---------------------------------------------------
; *** Card-Pairs  V1.0  CARD 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 Card Ranks ====================================
;=====================================================================================
(define CP1 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia1)(piece? clb1)(piece? hrt1)(piece? spd1) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CP2 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia2)(piece? clb2)(piece? hrt2)(piece? spd2) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CP3 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia3)(piece? clb3)(piece? hrt3)(piece? spd3) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CP4 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia4)(piece? clb4)(piece? hrt4)(piece? spd4) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CP5 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia5)(piece? clb5)(piece? hrt5)(piece? spd5) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CP6 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia6)(piece? clb6)(piece? hrt6)(piece? spd6) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CP7 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia7)(piece? clb7)(piece? hrt7)(piece? spd7) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CP8 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia8)(piece? clb8)(piece? hrt8)(piece? spd8) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CP9 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia9)(piece? clb9)(piece? hrt9)(piece? spd9) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CP10 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia10)(piece? clb10)(piece? hrt10)(piece? spd10) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CP11 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia11)(piece? clb11)(piece? hrt11)(piece? spd11) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CP12 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia12)(piece? clb12)(piece? hrt12)(piece? spd12) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CP13 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

   (if (or (piece? dia13)(piece? clb13)(piece? hrt13)(piece? spd13) )
	(MatchedUP)
      capture w capture back capture w capture ;equal: delete both items
   else
      (change-type button) 
      back
      (change-type button)
   ) 
   (MoveCounterUP)
   add
 )
)
(define CPJ ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

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


;=====================================================================================
;============================= Compare Black Cards ===================================
;=====================================================================================
(define CPBK1 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


;=====================================================================================
;============================== Compare Red Cards ====================================
;=====================================================================================
(define CPRD1 ; compare selected items
 (
   to
   (verify (piece? $1)) 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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