[aisleriot] gaps: Avoid the use of get-name.



commit cc36ffb133dc28454d2e4a7d5db6bcc8aecd2b11
Author: Vincent Povirk <madewokherd gmail com>
Date:   Fri Jun 29 18:59:22 2012 -0500

    gaps: Avoid the use of get-name.
    
    For bug 551859.

 games/gaps.scm |   66 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 61 insertions(+), 5 deletions(-)
---
diff --git a/games/gaps.scm b/games/gaps.scm
index d5c7cf7..772069b 100644
--- a/games/gaps.scm
+++ b/games/gaps.scm
@@ -303,6 +303,66 @@
           (add-to-sequence? (+ row 1))
           #f)))
 
+(define (hint-move-card card)
+  (let ((value (get-value card)) (suit (get-suit card)))
+     (cond ((eq? suit club) 
+            (cond ((eq? value ace) (_"Place the two of clubs next to the ace of clubs."))
+                  ((eq? value 2) (_"Place the three of clubs next to the two of clubs."))
+                  ((eq? value 3) (_"Place the four of clubs next to the three of clubs."))
+                  ((eq? value 4) (_"Place the five of clubs next to the four of clubs."))
+                  ((eq? value 5) (_"Place the six of clubs next to the five of clubs."))
+                  ((eq? value 6) (_"Place the seven of clubs next to the six of clubs."))
+                  ((eq? value 7) (_"Place the eight of clubs next to the seven of clubs."))
+                  ((eq? value 8) (_"Place the nine of clubs next to the eight of clubs."))
+                  ((eq? value 9) (_"Place the ten of clubs next to the nine of clubs."))
+                  ((eq? value 10) (_"Place the jack of clubs next to the ten of clubs."))
+                  ((eq? value jack) (_"Place the queen of clubs next to the jack of clubs."))
+                  ((eq? value queen) (_"Place the king of clubs next to the queen of clubs."))
+                  (#t "ERROR")))
+           ((eq? suit spade) 
+            (cond ((eq? value ace) (_"Place the two of spades next to the ace of spades."))
+                  ((eq? value 2) (_"Place the three of spades next to the two of spades."))
+                  ((eq? value 3) (_"Place the four of spades next to the three of spades."))
+                  ((eq? value 4) (_"Place the five of spades next to the four of spades."))
+                  ((eq? value 5) (_"Place the six of spades next to the five of spades."))
+                  ((eq? value 6) (_"Place the seven of spades next to the six of spades."))
+                  ((eq? value 7) (_"Place the eight of spades next to the seven of spades."))
+                  ((eq? value 8) (_"Place the nine of spades next to the eight of spades."))
+                  ((eq? value 9) (_"Place the ten of spades next to the nine of spades."))
+                  ((eq? value 10) (_"Place the jack of spades next to the ten of spades."))
+                  ((eq? value jack) (_"Place the queen of spades next to the jack of spades."))
+                  ((eq? value queen) (_"Place the king of spades next to the queen of spades."))
+                  (#t "ERROR")))
+           ((eq? suit heart) 
+            (cond ((eq? value ace) (_"Place the two of hearts next to the ace of hearts."))
+                  ((eq? value 2) (_"Place the three of hearts next to the two of hearts."))
+                  ((eq? value 3) (_"Place the four of hearts next to the three of hearts."))
+                  ((eq? value 4) (_"Place the five of hearts next to the four of hearts."))
+                  ((eq? value 5) (_"Place the six of hearts next to the five of hearts."))
+                  ((eq? value 6) (_"Place the seven of hearts next to the six of hearts."))
+                  ((eq? value 7) (_"Place the eight of hearts next to the seven of hearts."))
+                  ((eq? value 8) (_"Place the nine of hearts next to the eight of hearts."))
+                  ((eq? value 9) (_"Place the ten of hearts next to the nine of hearts."))
+                  ((eq? value 10) (_"Place the jack of hearts next to the ten of hearts."))
+                  ((eq? value jack) (_"Place the queen of hearts next to the jack of hearts."))
+                  ((eq? value queen) (_"Place the king of hearts next to the queen of hearts."))
+                  (#t "ERROR")))
+           ((eq? suit diamond) 
+            (cond ((eq? value ace) (_"Place the two of diamonds next to the ace of diamonds."))
+                  ((eq? value 2) (_"Place the three of diamonds next to the two of diamonds."))
+                  ((eq? value 3) (_"Place the four of diamonds next to the three of diamonds."))
+                  ((eq? value 4) (_"Place the five of diamonds next to the four of diamonds."))
+                  ((eq? value 5) (_"Place the six of diamonds next to the five of diamonds."))
+                  ((eq? value 6) (_"Place the seven of diamonds next to the six of diamonds."))
+                  ((eq? value 7) (_"Place the eight of diamonds next to the seven of diamonds."))
+                  ((eq? value 8) (_"Place the nine of diamonds next to the eight of diamonds."))
+                  ((eq? value 9) (_"Place the ten of diamonds next to the nine of diamonds."))
+                  ((eq? value 10) (_"Place the jack of diamonds next to the ten of diamonds."))
+                  ((eq? value jack) (_"Place the queen of diamonds next to the jack of diamonds."))
+                  ((eq? value queen) (_"Place the king of diamonds next to the queen of diamonds."))
+                  (#t "ERROR")))
+           (#t "ERROR"))))
+
 (define (playable-gap? slotlist)
   (if (null? slotlist)
       #f
@@ -311,11 +371,7 @@
                (not (= king (get-value(get-top-card(- (car slotlist) 1)))))
 	       )
 	  (let ((target-card (get-top-card (- (car slotlist) 1))))
-	    (list 0 (format
-                     #f
-                     (_"Place the ~a next to ~a.")
-		     (get-name (add-to-value target-card 1))
-		     (get-name target-card))))
+	    (list 0 (hint-move-card target-card)))
            (playable-gap? (cdr slotlist))
       )
   )



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