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

  1. ; AisleRiot - cover.scm
  2. ; Copyright (C) 2001, 2003 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.   (set-ace-low)
  22.   (make-standard-deck)
  23.   (shuffle-deck)
  24.  
  25.   (add-normal-slot DECK)
  26.  
  27.   (add-carriage-return-slot)
  28.  
  29.   (add-normal-slot '())
  30.   (add-normal-slot '())
  31.   (add-normal-slot '())
  32.   (add-normal-slot '())
  33.  
  34.   (deal-cards-face-up 0 '(1 2 3 4))
  35.  
  36.   (list 4 2))
  37.  
  38. (define (give-status-message)
  39.   (set-statusbar-message (get-stock-no-string)))
  40.  
  41. (define (get-stock-no-string)
  42.   (string-append (_"Stock left:") " "
  43.          (number->string (length (get-cards 0)))))
  44.  
  45. (define (button-pressed slot-id card-list)
  46.   (and (not (empty-slot? slot-id))
  47.        (not (= slot-id 0))))
  48.  
  49. (define (droppable? start-slot card-list end-slot)
  50.   (and (not (empty-slot? end-slot))
  51.        (not (= end-slot 0))
  52.        (= (get-suit (get-top-card end-slot))
  53.           (get-suit (car card-list)))))
  54.  
  55.  
  56. (define (button-released start-slot card-list end-slot)
  57.   (and (droppable? start-slot card-list end-slot)
  58.        (add-to-score! 2)
  59.        (remove-card end-slot)
  60.        (or (empty-slot? 0)
  61.        (deal-cards-face-up 0 (list start-slot)))
  62.        (or (empty-slot? 0)
  63.        (deal-cards-face-up 0 (list end-slot)))))
  64.  
  65. (define (button-clicked slot-id)
  66.   #f)
  67.  
  68. (define (button-double-clicked slot-id)
  69.   #f)
  70.  
  71. (define (game-continuable)
  72.   (and (give-status-message)
  73.        (not (game-won))
  74.        (get-hint)))
  75.  
  76. (define (game-won)
  77.   (empty-slot? 0))
  78.  
  79. (define (check-suits slot1 slot2)
  80.   (cond ((= slot1 4)
  81.      #f)
  82.     ((= slot2 5)
  83.      (check-suits (+ 1 slot1) (+ 2 slot1)))
  84.     ((= (get-suit (get-top-card slot1))
  85.         (get-suit (get-top-card slot2)))
  86.      (list 1 (get-name (get-top-card slot1)) (get-name (get-top-card slot2))))
  87.     (#t (check-suits slot1 (+ 1 slot2)))))
  88.  
  89. (define (get-hint)
  90.   (check-suits 1 2))
  91.  
  92. (define (get-options) 
  93.   #f)
  94.  
  95. (define (apply-options options) 
  96.   #f)
  97.  
  98. (define (timeout) 
  99.   #f)
  100.  
  101. (set-features droppable-feature)
  102.  
  103. (set-lambda new-game button-pressed button-released button-clicked
  104. button-double-clicked game-continuable game-won get-hint get-options
  105. apply-options timeout droppable?)
  106.