[gnome-games] aisleriot: implement dealable feature in Canfield



commit de6d6b4ae801dcf805598f72e21c613f2eea55b2
Author: Vincent Povirk <madewokherd gmail com>
Date:   Thu Apr 23 23:59:38 2009 -0500

    aisleriot: implement dealable feature in Canfield
---
 aisleriot/TODO               |    2 +-
 aisleriot/rules/canfield.scm |   12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/aisleriot/TODO b/aisleriot/TODO
index 4feacca..b489c55 100644
--- a/aisleriot/TODO
+++ b/aisleriot/TODO
@@ -28,7 +28,7 @@ beleaguered_castle          NOT NEEDED
 block_ten                   NOT NEEDED
 bristol                     DONE
 camelot                     DONE
-canfield
+canfield                    DONE
 carpet
 chessboard                  NOT NEEDED
 clock                       NOT NEEDED
diff --git a/aisleriot/rules/canfield.scm b/aisleriot/rules/canfield.scm
index 77d9f69..b7990a0 100644
--- a/aisleriot/rules/canfield.scm
+++ b/aisleriot/rules/canfield.scm
@@ -162,9 +162,15 @@
 		    (and (= (get-value (get-top-card end-slot)) king)
 			   (= (get-value (car card-list)) ace)))) )))
 
+(define (dealable?)
+  (flippable? 0 1 -1))
+
+(define (do-deal-next-cards)
+  (flip-stock 0 1 -1 3))
+
 (define (button-clicked slot-id)
   (and (= slot-id 0)
-       (flip-stock 0 1 -1 3)))
+       (do-deal-next-cards)))
 
 (define (place-ace card slot)
   (remove-card slot)
@@ -305,6 +311,6 @@
 
 (define (timeout) #f)
 
-(set-features droppable-feature)
+(set-features droppable-feature dealable-feature)
 
-(set-lambda new-game button-pressed button-released button-clicked button-double-clicked game-over game-won get-hint get-options apply-options timeout droppable?)
+(set-lambda new-game button-pressed button-released button-clicked button-double-clicked game-over game-won get-hint get-options apply-options timeout droppable? dealable?)



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