143
145
(and (not (empty-slot? 0))
144
146
(list 0 (_"Deal the cards"))))
146
(define (check-slot-cards card card-list)
148
(define (check-slot-cards slot1 slot2 count card card-list)
147
149
(cond ((or (= (length card-list) 0)
148
150
(not (is-visible? (car card-list))))
151
153
(get-suit (car card-list)))
152
154
(= (get-value card)
153
155
(+ 1 (get-value (car card-list)))))
155
(#t (check-slot-cards card (cdr card-list)))))
156
(hint-move slot2 count slot1))
157
(#t (check-slot-cards slot1 slot2 (+ count 1) card (cdr card-list)))))
157
159
(define (check-a-slot slot1 slot2)
158
160
(cond ((= slot2 8)
160
162
((and (not (= slot1 slot2))
161
163
(not (empty-slot? slot2))
162
(check-slot-cards (get-top-card slot1) (get-cards slot2)))
164
(check-slot-cards slot1 slot2 1 (get-top-card slot1) (get-cards slot2)))
165
(check-slot-cards slot1 slot2 1 (get-top-card slot1) (get-cards slot2)))
164
166
(#t (check-a-slot slot1 (+ 1 slot2)))))
166
168
(define (check-slot slot-id)
169
171
((and (not (empty-slot? slot-id))
170
172
(check-a-slot slot-id 1))
172
(get-name (make-card (- (get-value (get-top-card slot-id)) 1)
173
(get-suit (get-top-card slot-id))))
174
(get-name (get-top-card slot-id))))
173
(check-a-slot slot-id 1))
175
174
(#t (check-slot (+ 1 slot-id)))))
177
(define (here-kingy-kingy card-list)
176
(define (here-kingy-kingy slot-id count card-list)
178
177
(cond ((or (= (length card-list) 0)
179
178
(= (length card-list) 1)
180
179
(not (is-visible? (car card-list))))
182
181
((= (get-value (car card-list)) king)
183
(list 2 (get-name (car card-list)) (_"an empty slot")))
184
(#t (here-kingy-kingy (cdr card-list)))))
182
(hint-move slot-id count (find-empty-slot tableau)))
183
(#t (here-kingy-kingy slot-id (+ count 1) (cdr card-list)))))
186
185
(define (king-avail? slot-id)
187
186
(cond ((= slot-id 8)
189
188
((and (not (empty-slot? slot-id))
190
(here-kingy-kingy (get-cards slot-id)))
191
(here-kingy-kingy (get-cards slot-id)))
189
(here-kingy-kingy slot-id 1 (get-cards slot-id)))
190
(here-kingy-kingy slot-id 1 (get-cards slot-id)))
192
191
(#t (king-avail? (+ 1 slot-id)))))
194
193
(define (check-for-empty)