1
; AisleRiot - triple_peaks.scm
2
; Copyright (C) 2005 Richard Hoelscher <rah@rahga.com>
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/>.
17
(use-modules (aisleriot interface) (aisleriot api))
19
(define progressive-rounds #f)
20
(define multiplier-scoring #f)
23
(initialize-playing-area)
28
(add-normal-slot DECK)
31
(add-extended-slot '() right)
33
(add-carriage-return-slot)
44
(add-carriage-return-slot)
45
(set! VERTPOS (- VERTPOS (/ 2 3)))
46
(set! HORIZPOS (+ HORIZPOS 0.5))
57
(add-carriage-return-slot)
58
(set! VERTPOS (- VERTPOS (/ 2 3)))
70
(add-carriage-return-slot)
71
(set! VERTPOS (- VERTPOS (/ 2 3)))
72
(set! HORIZPOS (+ HORIZPOS 0.5))
84
(deal-cards 0 ' (3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20))
85
(deal-cards-face-up 0 ' (21 22 23 24 25 26 27 28 29 30 2))
91
(define (progressive-redeal)
93
(add-cards! 0 (get-cards 1))
94
(remove-n-cards 1 (length (get-cards 1)))
96
(deal-cards 0 ' (3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20))
97
(deal-cards-face-up 0 ' (21 22 23 24 25 26 27 28 29 30 2))
100
(define (give-status-message)
101
(set-statusbar-message (get-stock-no-string)))
103
(define (get-stock-no-string)
104
(string-append (_"Stock left:") " "
105
(number->string (length (get-cards 0)))))
107
(define (button-pressed slot-id card-list)
108
(available? slot-id))
110
(define (check-for-flips slot-id)
111
(cond ((= slot-id 30)
257
(define (available? slot-id)
258
(and (not (empty-slot? slot-id))
260
(is-visible? (get-top-card slot-id))))
262
(define (movable? card)
263
(and (not (empty-slot? 2))
264
(or (eq? (modulo (+ 1 (get-value card)) 13)
265
(modulo (get-value (get-top-card 2)) 13))
266
(eq? (modulo (get-value card) 13)
267
(modulo (+ 1 (get-value (get-top-card 2))) 13)))))
269
(define (droppable? start-slot card-list end-slot)
270
(and (not (= start-slot end-slot))
272
(movable? (car card-list))))
274
(define (tally-score start-slot)
276
(if multiplier-scoring
277
(add-to-score! (integer-expt 2 (- (length (get-cards 2)) 2)))
278
(add-to-score! (- (length (get-cards 2)) 1)))
279
(check-bonus start-slot)
280
(check-for-flips start-slot)))
282
(define (check-bonus slot-id)
285
(if multiplier-scoring
288
(if multiplier-scoring
290
(add-to-score! 15))))
293
(progressive-redeal)))
295
(define (button-released start-slot card-list end-slot)
297
(movable? (car card-list))
298
(move-n-cards! start-slot end-slot card-list)
299
(tally-score start-slot)))
301
(define (do-deal-next-cards)
303
(deal-cards-face-up 0 '(2))
304
(if (not multiplier-scoring)
305
(set-score! (max (- (get-score) 5) 0)))))
307
(define (button-clicked slot-id)
309
(and (not (empty-slot? 0))
310
(do-deal-next-cards))
313
(movable? (get-top-card slot-id))
314
(deal-cards slot-id '(2))
315
(tally-score slot-id))))
318
(not (empty-slot? 0)))
320
(define (button-double-clicked slot-id)
321
(button-clicked slot-id))
323
(define (game-continuable)
324
(give-status-message)
325
(and (not (game-won))
333
(define (check-move slot-id)
335
(or (check-move (+ 1 slot-id))
336
(and (available? slot-id)
337
(movable? (get-top-card slot-id))
339
(get-name (get-top-card slot-id))
340
(get-name (get-top-card 2)))))))
343
(and (not (empty-slot? 0))
344
(list 0 (_"Deal a card"))))
350
(define (get-options)
351
(list (list (_"Progressive Rounds") progressive-rounds)
352
(list (_"Multiplier Scoring") multiplier-scoring)))
354
(define (apply-options options)
355
(set! progressive-rounds (cadar options))
356
(set! multiplier-scoring (cadadr options)))
361
(set-features droppable-feature dealable-feature)
363
(set-lambda new-game button-pressed button-released button-clicked button-double-clicked game-continuable game-won get-hint get-options apply-options timeout droppable? dealable?)