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

« back to all changes in this revision

Viewing changes to games/clock.scm

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jeremy Bicha, Jordi Mallach
  • Date: 2012-04-22 12:49:26 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120422124926-gmr0thwstl91jt1n
Tags: 1:3.4.1-1
[ Jeremy Bicha ]
* New upstream release
* debian/control.in: (Build)-depend on guile-2.0
* debian/*.install: Cards files are now stored as zipped .svg's
* debian/patches/99_format-security.patch: Dropped, applied upstream

[ Jordi Mallach ]
* New upstream release.
* Update copyright to final version of the machine-readable 1.0 spec.
* Bump Standards Version to 3.9.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
; You should have received a copy of the GNU General Public License
15
15
; along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
16
 
 
17
(use-modules (aisleriot interface) (aisleriot api))
 
18
 
17
19
(define (new-game)
18
20
  (initialize-playing-area)
19
21
  (make-standard-deck)
139
141
              (complete-transaction (list top-card) slot))))
140
142
      #f))
141
143
 
142
 
(define (make-all-visible slot)
143
 
  (if (< slot 13)
144
 
      (begin
145
 
        (make-visible (car (get-cards slot)))
146
 
        (make-visible (cadr (get-cards slot)))
147
 
        (make-visible (caddr (get-cards slot)))
148
 
        (make-visible (cadddr (get-cards slot)))
149
 
        (make-all-visible (+ slot 1)))))
 
144
(define (all-cards-visible cards)
 
145
  (if (eq? cards '())
 
146
      #t
 
147
      (and (is-visible? (car cards))
 
148
           (all-cards-visible (cdr cards)))))
150
149
 
 
150
(define (all-slots-visible first-slot)
 
151
  (if (= first-slot 13)
 
152
      #t
 
153
      (and (all-cards-visible (get-cards first-slot))
 
154
           (all-slots-visible (+ first-slot 1)))))
151
155
 
152
156
(define (game-won)
153
 
  (make-all-visible 0)
154
 
  (if (and (= (get-value (car (get-cards 2))) 1)
155
 
           (= (get-value (cadr (get-cards 2))) 1)
156
 
           (= (get-value (caddr (get-cards 2))) 1)
157
 
           (= (get-value (cadddr (get-cards 2))) 1)
158
 
           (= (get-value (car (get-cards 4))) 2)
159
 
           (= (get-value (cadr (get-cards 4))) 2)
160
 
           (= (get-value (caddr (get-cards 4))) 2)
161
 
           (= (get-value (cadddr (get-cards 4))) 2)
162
 
           (= (get-value (car (get-cards 7))) 3)
163
 
           (= (get-value (cadr (get-cards 7))) 3)
164
 
           (= (get-value (caddr (get-cards 7))) 3)
165
 
           (= (get-value (cadddr (get-cards 7))) 3)
166
 
           (= (get-value (car (get-cards 9))) 4)
167
 
           (= (get-value (cadr (get-cards 9))) 4)
168
 
           (= (get-value (caddr (get-cards 9))) 4)
169
 
           (= (get-value (cadddr (get-cards 9))) 4)
170
 
           (= (get-value (car (get-cards 12))) 5)
171
 
           (= (get-value (cadr (get-cards 12))) 5)
172
 
           (= (get-value (caddr (get-cards 12))) 5)
173
 
           (= (get-value (cadddr (get-cards 12))) 5)
174
 
           (= (get-value (car (get-cards 11))) 6)
175
 
           (= (get-value (cadr (get-cards 11))) 6)
176
 
           (= (get-value (caddr (get-cards 11))) 6)
177
 
           (= (get-value (cadddr (get-cards 11))) 6)
178
 
           (= (get-value (car (get-cards 10))) 7)
179
 
           (= (get-value (cadr (get-cards 10))) 7)
180
 
           (= (get-value (caddr (get-cards 10))) 7)
181
 
           (= (get-value (cadddr (get-cards 10))) 7)
182
 
           (= (get-value (car (get-cards 8))) 8)
183
 
           (= (get-value (cadr (get-cards 8))) 8)
184
 
           (= (get-value (caddr (get-cards 8))) 8)
185
 
           (= (get-value (cadddr (get-cards 8))) 8)
186
 
           (= (get-value (car (get-cards 5))) 9)
187
 
           (= (get-value (cadr (get-cards 5))) 9)
188
 
           (= (get-value (caddr (get-cards 5))) 9)
189
 
           (= (get-value (cadddr (get-cards 5))) 9)
190
 
           (= (get-value (car (get-cards 3))) 10)
191
 
           (= (get-value (cadr (get-cards 3))) 10)
192
 
           (= (get-value (caddr (get-cards 3))) 10)
193
 
           (= (get-value (cadddr (get-cards 3))) 10)
194
 
           (= (get-value (car (get-cards 0))) 11)
195
 
           (= (get-value (cadr (get-cards 0))) 11)
196
 
           (= (get-value (caddr (get-cards 0))) 11)
197
 
           (= (get-value (cadddr (get-cards 0))) 11)
198
 
           (= (get-value (car (get-cards 1))) 12)
199
 
           (= (get-value (cadr (get-cards 1))) 12)
200
 
           (= (get-value (caddr (get-cards 1))) 12)
201
 
           (= (get-value (cadddr (get-cards 1))) 12)
202
 
           )
203
 
      #t
204
 
      #f))
 
157
  (all-slots-visible 0))
205
158
 
206
159
(define (game-over)
207
160
  (not (and (is-visible? (car (reverse (get-cards 6))))
208
 
            (= (get-value (get-top-card 6)) king)
209
 
            (make-all-visible 0))))
 
161
            (= (get-value (get-top-card 6)) king))))
210
162
 
211
163
(define (nth-item list n)
212
164
  (if (= 0 n)
241
193
               (_"When without a stapler, a staple and a ruler will work")
242
194
               ; Translators: This is one of the sentences that are used when the user wants to get a hint. Since the 'clock' game is a joke in itself, the sentence it nonsensical and/or a joke. So you can substitute anything you like here; you don't have to translate the original sentence!
243
195
               (_"Never blow in a dog's ear"))
244
 
         (random 12))))
 
196
         (aisleriot-random 12))))
245
197
 
246
198
(define (get-options) #f)
247
199