Re: sol and sol "game over" test



> It would be nice to
> have a button to automatically move as many cards as possible from the
> tableau (bottom area) to the foundation (top area).

Double-click on a foundation.


We would need more than a proof to change the game-won test in
Klondike. There are other games where it's trivial to detect that the
game can be won just by plopping cards, but we generally don't count
it until all the cards are on foundations. I think it'd be rude if we
did.


There is a way to do your test without repeating yourself:

(define (all-cards-revealed cards)
  (if (= cards '())
    #t
    (and (is-visible? (car cards)) (all-cards-revealed (cdr cards)))))

(define (slots-revealed slots)
  (if (= slots '())
    #t
    (and (all-cards-revealed (get-cards (car slots))) (slots-revealed
(cdr slots)))))

(slots-revealed tableau)


The way you wrote it would break for other games that import
klondike.scm but use different slot numbers and configurations for the
tableau piles. In fact, even if the test is ok for klondike, it
probably isn't ok for these other games.


I don't think trying to cull unwinnable games is a good precedent,
especially by looking at cards that aren't revealed at the start of
the game.


Vincent Povirk


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