All pastes #35422 Raw Edit

itrebal

public text v1 · immutable
#35422 ·published 2006-01-01 06:32 UTC
rendered paste body
(define (button-double-clicked slot)
  (cond ((or (empty-slot? slot)
	     (= slot 0)
	     (> slot 7))
	 #f)
	((= (get-value (get-top-card slot)) ace)
	 (let ((top-card (get-top-card slot)))
	   (remove-card slot)
	   (cond ((empty-slot? 0)
		  (complete-transaction slot (list top-card) 0))
		 ((empty-slot? 8)
		  (complete-transaction slot (list top-card) 8))
		 ((empty-slot? 9)
		  (complete-transaction slot (list top-card) 9))
		 (#t
		  (complete-transaction slot (list top-card) 10)))))
      	((and (not (empty-slot? 0))
	      (= (get-suit (get-top-card 0))
		 (get-suit (get-top-card slot)))
	      (= (+ 1 (get-value (get-top-card 0)))
		 (get-value (get-top-card slot))))
	 (let ((top-card (get-top-card slot)))
	   (remove-card slot)
	   (complete-transaction slot (list top-card) 0)))
	((and (not (empty-slot? 8))
	      (= (get-suit (get-top-card 8))
		 (get-suit (get-top-card slot)))
	      (= (+ 1 (get-value (get-top-card 8)))
		 (get-value (get-top-card slot))))
	 (let ((top-card (get-top-card slot)))
	   (remove-card slot)
	   (complete-transaction slot (list top-card) 8)))
	((and (not (empty-slot? 9))
	      (= (get-suit (get-top-card 9))
		 (get-suit (get-top-card slot)))
	      (= (+ 1 (get-value (get-top-card 9)))
		 (get-value (get-top-card slot))))
	 (let ((top-card (get-top-card slot)))
	   (remove-card slot)
	   (complete-transaction slot (list top-card) 9)))
	((and (not (empty-slot? 10))
	      (= (get-suit (get-top-card 10))
		 (get-suit (get-top-card slot)))
	      (= (+ 1 (get-value (get-top-card 10)))
		 (get-value (get-top-card slot))))
	 (let ((top-card (get-top-card slot)))
	   (remove-card slot)
	   (complete-transaction slot (list top-card) 10)))
	(#t #f)))