[aisleriot] kansas: Simplify some hinting code.



commit 08031eb197cbe1bebe131f629b652b17dd8122e4
Author: Vincent Povirk <madewokherd gmail com>
Date:   Tue Oct 18 19:36:05 2011 -0500

    kansas: Simplify some hinting code.
    
    For bug 660297.

 games/kansas.scm |   30 ++++++++++--------------------
 1 files changed, 10 insertions(+), 20 deletions(-)
---
diff --git a/games/kansas.scm b/games/kansas.scm
index 513244d..dea0509 100644
--- a/games/kansas.scm
+++ b/games/kansas.scm
@@ -248,14 +248,14 @@
 (define (check-a-tableau-list card card-list)
   (cond ((= (length card-list) 0)
 	 #f)
-	((or (= (get-value card)
-		(+ 1 (get-value (car card-list))))
-	     (and (= (get-value card) ace)
-		  (= (get-value (car card-list)) king)))
-	 (and (or (check-a-foundation (cadr card-list) 2)
-		  (eq? (get-suit card)
-		       (get-suit (car card-list))))
-	      (list 1 (get-name (car card-list)) (get-name card))))
+        ((and (or (= (get-value card)
+                     (+ 1 (get-value (car card-list))))
+                  (and (= (get-value card) ace)
+                       (= (get-value (car card-list)) king)))
+              (or (check-a-foundation (cadr card-list) 2)
+                  (eq? (get-suit card)
+                       (get-suit (car card-list)))))
+              (list 1 (get-name (car card-list)) (get-name card)))
 	(#t
 	 (check-a-tableau-list card (cdr card-list)))))
 
@@ -264,6 +264,8 @@
 	 #f)
 	((= slot2 2)
 	 (check-a-tableau slot1 6))
+        ((= slot1 slot2)
+         (check-a-tableau slot1 (+ 1 slot2)))
 	((or (= slot2 1)
 	     (= slot2 6))
 	 (or (and (not (empty-slot? slot2))
@@ -285,18 +287,6 @@
 	       (get-name (car (reverse (get-cards slot2))))
 	       (get-name (get-top-card slot1))))
 	((and (not (empty-slot? slot2))
-	      (or (> (get-value (get-top-card slot1))
-		     (get-value (get-top-card slot2)))
-		  (and (>= (get-value (get-top-card slot1)) ace)
-		       (< (get-value (get-top-card slot1)) BASE-VAL)
-		       (<= (get-value (get-top-card slot2)) king)
-		       (> (get-value (get-top-card slot2)) BASE-VAL)))
-	      (or (<= (get-value (get-top-card slot1))
-		      (get-value (car (reverse (get-cards slot2)))))
-		  (and (<= (get-value (get-top-card slot1)) king)
-		       (> (get-value (get-top-card slot1)) BASE-VAL)
-		       (>= (get-value (car (reverse (get-cards slot2)))) ace)
-		       (< (get-value (car (reverse (get-cards slot2)))) BASE-VAL)))
 	      (check-a-tableau-list (get-top-card slot1)
 				    (get-cards slot2)))
 	 (check-a-tableau-list (get-top-card slot1)



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