~ubuntu-branches/debian/jessie/aisleriot/jessie

« back to all changes in this revision

Viewing changes to games/scorpion.scm

  • Committer: Package Import Robot
  • Author(s): Emilio Pozuelo Monfort, Jeremy Bicha, Robert Ancell, Rico Tzschichholz, Emilio Pozuelo Monfort
  • Date: 2013-05-25 19:56:23 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130525195623-im6ppfonxjy1jarp
Tags: 1:3.8.0-1
[ Jeremy Bicha ]
* New upstream release.
* debian/control.in:
  - Build-depend on desktop-file-utils
  - Recommend yelp
  - Remove obsolete libgstreamer build-depends 

[ Robert Ancell ]
* debian/aisleriot.install:
* debian/aisleriot.menu:
* debian/patches/02_desktop-path.patch:
* debian/pixmaps/freecell.xpm:
  - Updated as freecell.desktop is removed

[ Rico Tzschichholz ]
* debian/control.in: Bump Build-Deps on libgtk-3-dev (>= 3.4.0),
  libglib2.0-dev (>= 2.32.0)

[ Emilio Pozuelo Monfort ]
* debian/watch:
  + Fixed, it wasn't tracking new versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
(use-modules (aisleriot interface) (aisleriot api))
18
18
; winning game seed: 2036201447
19
19
 
 
20
(define tableau '(1 2 3 4 5 6 7))
 
21
 
20
22
(define (new-game)
21
23
  (initialize-playing-area)
22
24
  (set-ace-low)
143
145
  (and (not (empty-slot? 0))
144
146
       (list 0 (_"Deal the cards"))))
145
147
 
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))))
149
151
         #f)
151
153
                   (get-suit (car card-list)))
152
154
              (= (get-value card)
153
155
                 (+ 1 (get-value (car card-list)))))
154
 
         #t)
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)))))
156
158
 
157
159
(define (check-a-slot slot1 slot2)
158
160
  (cond ((= slot2 8)
159
161
         #f)
160
162
        ((and (not (= slot1 slot2))
161
163
              (not (empty-slot? slot2))
162
 
              (check-slot-cards (get-top-card slot1) (get-cards slot2)))
163
 
         #t)
 
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)))))
165
167
 
166
168
(define (check-slot slot-id)
168
170
         #f)
169
171
        ((and (not (empty-slot? slot-id))
170
172
              (check-a-slot slot-id 1))
171
 
         (list 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)))))
176
175
 
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))))
181
180
         #f)
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)))))
185
184
 
186
185
(define (king-avail? slot-id)
187
186
  (cond ((= slot-id 8)
188
187
         #f)
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)))))
193
192
 
194
193
(define (check-for-empty)