[aisleriot] forty-thieves: Try to build on non-empty tableau piles first.



commit 029cf27e6742d12740a4e148fe58a72f9997b6f9
Author: Vincent Povirk <madewokherd gmail com>
Date:   Sun Jul 7 15:57:04 2013 -0500

    forty-thieves: Try to build on non-empty tableau piles first.
    
    For bug 678188.

 games/forty-thieves.scm |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/games/forty-thieves.scm b/games/forty-thieves.scm
index f789482..46c3668 100644
--- a/games/forty-thieves.scm
+++ b/games/forty-thieves.scm
@@ -243,14 +243,20 @@
 
 (define (find-tableau-place-helper from-slot card to-slots)
   (if (null? to-slots)
-      (list #f)
-      (if (and (tableau-droppable? from-slot (list card) (car to-slots)) (<> from-slot (car to-slots)))
+      #f
+      (if (and
+            (not (empty-slot? (car to-slots)))
+            (tableau-droppable? from-slot (list card) (car to-slots))
+            (<> from-slot (car to-slots)))
           (list #t from-slot (car to-slots))
           (find-tableau-place-helper from-slot card (cdr to-slots)))))
 
 (define (find-tableau-place from-slot card )
   (if (not (empty-slot? from-slot))
-      (find-tableau-place-helper from-slot card tableau)
+      (or
+        (find-tableau-place-helper from-slot card tableau)
+        (and (find-empty-slot tableau) (list #t from-slot (find-empty-slot tableau)))
+        (list #f))
       (list #f)))
 
 


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