athena.scm 2.5 KB
Newer Older
1 2 3 4 5
;; AisleRiot - athena.scm  -*-scheme-*- 
;; Copyright (C) Alan Horkan, 2005.  
;; based on klondike.scm
; Copyright (C) 1998, 2003 Jonathan Blandford <jrb@mit.edu>
;
6
; This program is free software: you can redistribute it and/or modify
7
; it under the terms of the GNU General Public License as published by
8 9
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
10 11 12 13 14 15 16
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
17
; along with this program.  If not, see <http://www.gnu.org/licenses/>.
18

19 20
(use-modules (aisleriot interface) (aisleriot api))

21 22 23 24 25 26
;; Athena differs from Klondike only in the intial layout
;; including 1 or 3 card deal, and any other options like ...
;; Optional "King Only" enabled by default [TODO]
;; TODO rewrite in a way less redundant way and share code with Klondike
;; As seen in Pretty Good Solitaire 10  http://goodsol.com  2005.  

27
(primitive-load-path "klondike")
28 29

(define deal-one #t)
30
(define deal-three #f)
31 32 33
(define no-redeal #f)

(define max-redeal 2)
34 35 36 37 38 39 40 41 42 43 44 45 46 47

; The set up:

(define tableau '(6 7 8 9 10 11 12))
(define foundation '(2 3 4 5))
(define stock 0)
(define waste 1)

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

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

49
  (add-normal-slot DECK 'stock)
50 51

  (if deal-three
52 53
      (add-partially-extended-slot '() right 3 'waste)
      (add-normal-slot '() 'waste))
54 55

  (add-blank-slot)
56 57 58 59
  (add-normal-slot '() 'foundation)
  (add-normal-slot '() 'foundation)
  (add-normal-slot '() 'foundation)
  (add-normal-slot '() 'foundation)
60
  (add-carriage-return-slot)
61 62 63 64 65 66 67
  (add-extended-slot '() down 'tableau)
  (add-extended-slot '() down 'tableau)
  (add-extended-slot '() down 'tableau)
  (add-extended-slot '() down 'tableau)
  (add-extended-slot '() down 'tableau)
  (add-extended-slot '() down 'tableau)
  (add-extended-slot '() down 'tableau)
68

69 70 71 72
  (deal-cards stock tableau) 
  (deal-cards-face-up stock tableau) 
  (deal-cards stock tableau) 
  (deal-cards-face-up stock tableau) 
73 74 75 76 77 78 79 80 81 82 83 84

  (give-status-message)

  (list 7 3)
)

(define (get-options)
  (list (list (_"Three card deals") deal-three)))

(define (apply-options options)
  (set! deal-three (cadar options)))

85 86 87
(set-lambda! 'new-game new-game)
(set-lambda! 'get-options get-options)
(set-lambda! 'apply-options apply-options)