[gnome-games] aisleriot: add a hint for when there are too few cards in Spider games
- From: Vincent Povirk <vpovirk src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games] aisleriot: add a hint for when there are too few cards in Spider games
- Date: Sun, 14 Jun 2009 23:09:27 -0400 (EDT)
commit 6d0c57e0558787389533bbef63f01afec491380a
Author: Vincent Povirk <madewokherd gmail com>
Date: Mon May 25 17:43:45 2009 -0500
aisleriot: add a hint for when there are too few cards in Spider games
bug #407329
aisleriot/rules/spider.scm | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/aisleriot/rules/spider.scm b/aisleriot/rules/spider.scm
index 7fd1612..5c4a369 100644
--- a/aisleriot/rules/spider.scm
+++ b/aisleriot/rules/spider.scm
@@ -273,8 +273,20 @@
(list 0 (_"Deal another round"))
#f))
+(define (count-cards slots acc)
+ (if (null? slots)
+ acc
+ (count-cards (cdr slots) (+ acc (length (get-cards (car slots)))))))
+
+(define (hint-few-tableau-cards)
+ (and (not allow-empty-slots)
+ (not (empty-slot? stock))
+ (< (count-cards tableau 0) (length tableau))
+ (list 0 (_"Undo until there are enough cards to fill all tableau piles"))))
+
(define (get-hint)
- (or (same-suit-check tableau)
+ (or (hint-few-tableau-cards)
+ (same-suit-check tableau)
(not-same-suit-check tableau)
(open-slots? tableau)
(dealable?)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]