diamond-mine: Do not shadow functions in api.scm
Shadowing function find-card might cause other
games to crash when played after Diamond Mine
(bug 551859).
Unrelated to that, one variable is renamed
(size -> slot) for clarity and one redundant
expression in a conditional statement is removed.
Otto Wallenius authored 4 years ago
Christian Persch committed 4 years ago
274 | 274 | (search-a-slot card-suit card-rank (cdr card-list))) |
275 | 275 | (#t #f))) |
276 | 276 | |
277 | (define (find-card card-suit card-rank slot) | |
277 | (define (visible-on-tableau? card-suit card-rank slot) | |
278 | 278 | (cond ((= slot 14) |
279 | 279 | #f) |
280 | 280 | ((and (not (empty-slot? slot)) |
281 | 281 | (search-a-slot card-suit card-rank (get-cards slot))) |
282 | 282 | #t) |
283 | (#t (find-card card-suit card-rank (+ 1 slot))))) | |
284 | ||
285 | (define (check-a-tab-slot card-list size) | |
283 | (#t (visible-on-tableau? card-suit card-rank (+ 1 slot))))) | |
284 | ||
285 | (define (check-a-tab-slot card-list slot) | |
286 | 286 | (cond ((or (< (length card-list) 2) |
287 | 287 | (not (is-visible? (cadr card-list)))) |
288 | 288 | #f) |
289 | ((and (is-visible? (cadr card-list)) | |
290 | (not (= (get-suit (car card-list)) | |
289 | ((and (not (= (get-suit (car card-list)) | |
291 | 290 | (get-suit (cadr card-list)))) |
292 | (find-card (get-suit (car card-list)) (+ 1 (get-value (car card-list))) 1)) | |
293 | size) | |
294 | (#t (check-a-tab-slot (cdr card-list) (+ size 1))))) | |
291 | (visible-on-tableau? (get-suit (car card-list)) (+ 1 (get-value (car card-list))) 1)) | |
292 | slot) | |
293 | (#t (check-a-tab-slot (cdr card-list) (+ slot 1))))) | |
295 | 294 | |
296 | 295 | (define (check-tableau-suit-changes slot) |
297 | 296 | (cond ((or (= slot 14) |