1
; AisleRiot - block_ten.scm
2
; Copyright (C) 2001, 2003 Rosanna Yuen <zana@webwynk.net>
4
; This program 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 3 of the License, or
7
; (at your option) any later version.
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.
14
; You should have received a copy of the GNU General Public License
15
; along with this program. If not, see <http://www.gnu.org/licenses/>.
18
(initialize-playing-area)
22
(add-normal-slot DECK)
28
(add-carriage-return-slot)
35
(add-carriage-return-slot)
43
(deal-cards-face-up 0 '(1 2 3 4 5 6 7 8 9))
48
(define (give-status-message)
49
(set-statusbar-message (get-stock-no-string)))
51
(define (get-stock-no-string)
52
(string-append (_"Stock left:") " "
53
(number->string (length (get-cards 0)))))
55
(define (button-pressed slot-id card-list)
56
(and (not (empty-slot? slot-id))
59
(define (check-for-deal start-slot end-slot)
61
(and (deal-cards-face-up 0 (list start-slot))
63
(deal-cards-face-up 0 (list end-slot))))))
65
(define (button-released start-slot card-list end-slot)
66
(and (droppable? start-slot card-list end-slot)
67
(remove-card end-slot)
68
(check-for-deal start-slot end-slot)
71
(define (droppable? start-slot card-list end-slot)
72
(and (not (= end-slot 0))
73
(not (empty-slot? end-slot))
74
(or (= 10 (+ (get-value (car card-list))
75
(get-value (get-top-card end-slot))
78
(and (> (get-value (car card-list)) 10)
79
(= (get-value (get-top-card end-slot))
80
(get-value (car card-list))
86
(define (button-clicked slot-id)
89
(define (button-double-clicked slot-id)
92
(define (game-continuable)
98
(and (or (empty-slot? 1)
99
(= (get-value (get-top-card 1)) 10))
101
(= (get-value (get-top-card 2)) 10))
103
(= (get-value (get-top-card 3)) 10))
105
(= (get-value (get-top-card 4)) 10))
107
(= (get-value (get-top-card 5)) 10))
109
(= (get-value (get-top-card 6)) 10))
111
(= (get-value (get-top-card 7)) 10))
113
(= (get-value (get-top-card 8)) 10))
115
(= (get-value (get-top-card 9)) 10))))
117
(define (avail-pair? slot1 slot2)
120
((or (empty-slot? slot1)
122
(avail-pair? (+ 1 slot1) (+ 2 slot1)))
123
((and (not (empty-slot? slot2))
124
(or (= 10 (+ (get-value (get-top-card slot1))
125
(get-value (get-top-card slot2))))
126
(and (> (get-value (get-top-card slot1)) 10)
127
(= (get-value (get-top-card slot1))
128
(get-value (get-top-card slot2))))))
130
(get-name (get-top-card slot1))
131
(get-name (get-top-card slot2))))
132
(#t (avail-pair? slot1 (+ 1 slot2)))))
137
(define (get-options)
140
(define (apply-options options)
146
(set-features droppable-feature)
148
(set-lambda new-game button-pressed button-released button-clicked
149
button-double-clicked game-continuable game-won get-hint get-options
150
apply-options timeout droppable?)