;; AisleRiot - aunt_mary.scm  -*-scheme-*- 
;; Copyright (C) Alan Horkan, 2005.  
;; Aunt Mary is a very difficult Klondike variation.  
;; 
;; Goodsol gives odds as < 1%.  It is possible to win in theory.  
;; In practice I've only ever won when the deck wasn't shuffled

;; TODO: "King Only" option needs to be implemented in Klondike 
;; Option to disable "King Only" not included in goodsol Aunt Mary, 
;; the game is difficult enough, would like option to disable it.  

(load "klondike.scm") 

(define deal-three #f)

(define tableau '(6 7 8 9 10 11))

(define (new-game)
  (initialize-playing-area)
  (set-ace-low)

  (make-standard-deck)
  (shuffle-deck)

  ;; Stock 
  (add-normal-slot DECK)
  (if deal-three
      (add-partially-extended-slot '() right 3)
      (add-normal-slot '()))

  ;; Foundation (4)
  (add-normal-slot '())
  (add-normal-slot '())
  (add-normal-slot '())
  (add-normal-slot '())
  (add-carriage-return-slot)
  ;; Tableau (6)
  (add-extended-slot '() down)
  (add-extended-slot '() down)
  (add-extended-slot '() down)
  (add-extended-slot '() down)
  (add-extended-slot '() down)
  (add-extended-slot '() down)

  ;; Pretty Good Solitaire (goodsol) deals Aunt Mary like this
  (deal-cards stock 
    '(  7 8 9 10 11 
          8 9 10 11  
            9 10 11 
              10 11 
                 11))
  (deal-cards-face-up stock 
    '(6 
      6 7 
      6 7 8 
      6 7 8 9 
      6 7 8 9 10 
      6 7 8 9 10 11))

  ;; Alternative method, a little more complicated to implement
  ;; but more like how a real person might deal -- Alan Horkan.    
  ;; TODO Do something useful with this ;)
  ;; maybe put it behind an if statement rather than commented out? 
;  (deal-cards-face-up stock '(6            ))
;  (deal-cards stock         '(  7 8 9 10 11)) 
;  (deal-cards-face-up stock '(6 7          )) 
;  (deal-cards stock         '(    8 9 10 11))  
;  (deal-cards-face-up stock '(6 7 8        )) 
;  (deal-cards stock         '(      9 10 11)) 
;  (deal-cards-face-up stock '(6 7 8 9      )) 
;  (deal-cards stock         '(        10 11)) 
;  (deal-cards-face-up stock '(6 7 8 9 10   )) 
;  (deal-cards stock         '(           11))
;  (deal-cards-face-up stock '(6 7 8 9 10 11))
  
;  (map flip-top-card tableau)  

  (give-status-message)

  (list 7 3) 
)

;; One attempt.  No redeals
(define (get-redeals-string)
  (string-append (_"Redeals left:") " "
;; ALAN		 (number->string (- 2 FLIP-COUNTER))))
		 (number->string (- 0 FLIP-COUNTER))))

(set-lambda new-game button-pressed button-released button-clicked button-double-clicked game-over game-won get-hint get-options apply-options timeout)
