gnome-games r9025 - trunk/aisleriot/rules



Author: vpovirk
Date: Thu Apr  9 04:32:05 2009
New Revision: 9025
URL: http://svn.gnome.org/viewvc/gnome-games?rev=9025&view=rev

Log:
aisleriot: don't count no-op deals in Monte Carlo as a move

This fixes a test failure (see bug 569936).


Modified:
   trunk/aisleriot/rules/monte_carlo.scm

Modified: trunk/aisleriot/rules/monte_carlo.scm
==============================================================================
--- trunk/aisleriot/rules/monte_carlo.scm	(original)
+++ trunk/aisleriot/rules/monte_carlo.scm	Thu Apr  9 04:32:05 2009
@@ -110,26 +110,25 @@
        (add-to-score! 2)
        (remove-card end-slot)))
 
-(define (deal-the-empties slot)
+(define (deal-the-empties slot acc)
   (if (or (= slot 26)
 	  (empty-slot? 0))
-      #t
+      acc
       (and (deal-cards-face-up 0 (list slot))
-	   (deal-the-empties (+ 1 slot)))))
+	   (deal-the-empties (+ 1 slot) #t))))
 
-(define (moving-over slot blanks)
+(define (moving-over slot blanks acc)
   (cond ((= slot 26)
-	 (deal-the-empties (- 26 blanks)))
+	 (deal-the-empties (- 26 blanks) acc))
 	((empty-slot? slot)
-	 (moving-over (+ 1 slot) (+ 1 blanks)))
+	 (moving-over (+ 1 slot) (+ 1 blanks) acc))
 	((> blanks 0)
 	 (and (deal-cards slot (list (- slot blanks)))
-	      (moving-over (+ 1 slot) blanks)))
-	(#t (moving-over (+ 1 slot) blanks))))
+	      (moving-over (+ 1 slot) blanks #t)))
+	(#t (moving-over (+ 1 slot) blanks acc))))
 
 (define (move-cards-up)
-  (or (moving-over 1 0)
-      #t))
+  (moving-over 1 0 #f))
 
 (define (button-clicked slot-id)
   (and (= slot-id 0)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]