home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / sol-games / isabel.scm < prev    next >
Encoding:
Text File  |  2006-08-22  |  3.3 KB  |  132 lines

  1. ; AisleRiot - isabel.scm
  2. ; Copyright (C) 2001 Rosanna Yuen <zana@webwynk.net>
  3. ;
  4. ; This game is free software; you can redistribute it and/or modify
  5. ; it under the terms of the GNU General Public License as published by
  6. ; the Free Software Foundation; either version 2, or (at your option)
  7. ; any later version.
  8. ;
  9. ; This program is distributed in the hope that it will be useful,
  10. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. ; GNU General Public License for more details.
  13. ;
  14. ; You should have received a copy of the GNU General Public License
  15. ; along with this program; if not, write to the Free Software
  16. ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  17. ; USA
  18.  
  19. (define (new-game)
  20.   (initialize-playing-area)
  21.   (make-standard-deck)
  22.   (shuffle-deck)
  23.  
  24.   (add-normal-slot '())
  25.   (add-blank-slot)
  26.   (add-normal-slot '())
  27.   (add-blank-slot)
  28.   (add-normal-slot '())
  29.   (add-carriage-return-slot)
  30.   (add-normal-slot '())
  31.   (add-blank-slot)
  32.   (add-normal-slot '())
  33.   (add-blank-slot)
  34.   (add-normal-slot '())
  35.   (add-carriage-return-slot)
  36.   (add-normal-slot '())
  37.   (add-blank-slot)
  38.   (add-normal-slot '())
  39.   (add-blank-slot)
  40.   (add-normal-slot '())
  41.  
  42.   (set! HORIZPOS 0)
  43.   (set! VERTPOS 0.5)
  44.  
  45.   (add-blank-slot)
  46.   (add-normal-slot '())
  47.   (add-blank-slot)
  48.   (add-normal-slot '())
  49.   (add-carriage-return-slot)
  50.   (add-blank-slot)
  51.   (add-normal-slot '())
  52.   (add-blank-slot)
  53.   (add-normal-slot '())
  54.   
  55.   (add-carriage-return-slot)  
  56.   (add-carriage-return-slot)
  57.   (add-carriage-return-slot)  
  58.   (add-carriage-return-slot)
  59.   (add-carriage-return-slot)  
  60.   (add-carriage-return-slot)
  61.  
  62.   (add-normal-slot DECK)
  63.  
  64.   (deal-cards 13 '(0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10
  65.              11 12 0 1 2 3 4 5 6 7 8 9 10 11 12))
  66.   (deal-cards-face-up 13 '(0 1 2 3 4 5 6 7 8 9 10 11 12))
  67.  
  68.   (list 5 3))
  69.  
  70. (define (button-pressed slot-id card-list)
  71.   (not (empty-slot? slot-id)))
  72.  
  73. (define (droppable? start-slot card-list end-slot)
  74.   (and (not (empty-slot? end-slot))
  75.        (not (= start-slot end-slot))
  76.        (= (get-value (car card-list))
  77.       (get-value (get-top-card end-slot)))))
  78.  
  79. (define (button-released start-slot card-list end-slot)
  80.   (and (droppable? start-slot card-list end-slot)
  81.        (remove-card end-slot)
  82.        (add-to-score! 2)
  83.        (or (empty-slot? start-slot)
  84.        (flip-top-card start-slot))
  85.        (or (empty-slot? end-slot)
  86.        (flip-top-card end-slot))))
  87.  
  88. (define (button-clicked slot-id)
  89.   #f)
  90.  
  91. (define (button-double-clicked slot-id)
  92.   #f)
  93.  
  94. (define (game-continuable)
  95.   (and (not (game-won))
  96.        (get-hint)))
  97.  
  98. (define (game-won)
  99.   (= (get-score) 52))
  100.  
  101. (define (check-for-pairs slot1 slot2)
  102.   (cond ((= slot1 13)
  103.      #f)
  104.     ((or (= slot2 13)
  105.          (empty-slot? slot1))
  106.      (check-for-pairs (+ 1 slot1) (+ 2 slot1)))
  107.     ((and (not (empty-slot? slot2))
  108.           (= (get-value (get-top-card slot1))
  109.          (get-value (get-top-card slot2))))
  110.      (list 1 
  111.            (get-name (get-top-card slot1)) 
  112.            (get-name (get-top-card slot2))))
  113.     (#t (check-for-pairs slot1 (+ 1 slot2)))))
  114.  
  115. (define (get-hint)
  116.   (check-for-pairs 0 1))
  117.  
  118. (define (get-options) 
  119.   #f)
  120.  
  121. (define (apply-options options) 
  122.   #f)
  123.  
  124. (define (timeout) 
  125.   #f)
  126.  
  127. (set-features droppable-feature)
  128.  
  129. (set-lambda new-game button-pressed button-released button-clicked
  130. button-double-clicked game-continuable game-won get-hint get-options
  131. apply-options timeout droppable?)
  132.