/[emacs]/emacs/lisp/play/solitaire.el
ViewVC logotype

Diff of /emacs/lisp/play/solitaire.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by eliz, Fri Apr 12 19:08:32 2002 UTC revision 1.10.2.1 by miles, Fri Apr 4 06:20:31 2003 UTC
# Line 1  Line 1 
1  ;;; solitaire.el --- game of solitaire in Emacs Lisp  ;;; solitaire.el --- game of solitaire in Emacs Lisp
2    
3  ;; Copyright (C) 1994 Free Software Foundation, Inc.  ;; Copyright (C) 1994, 2003 Free Software Foundation, Inc.
4    
5  ;; Author: Jan Schormann <Jan.Schormann@rechen-gilde.de>  ;; Author: Jan Schormann <Jan.Schormann@rechen-gilde.de>
6  ;; Created: Fri afternoon, Jun  3,  1994  ;; Created: Fri afternoon, Jun  3,  1994
# Line 55  Line 55 
55    (define-key solitaire-mode-map "\C-p" 'solitaire-up)    (define-key solitaire-mode-map "\C-p" 'solitaire-up)
56    (define-key solitaire-mode-map "\C-n" 'solitaire-down)    (define-key solitaire-mode-map "\C-n" 'solitaire-down)
57    (define-key solitaire-mode-map [return] 'solitaire-move)    (define-key solitaire-mode-map [return] 'solitaire-move)
58    (substitute-key-definition 'undo 'solitaire-undo    (define-key solitaire-mode-map [remap undo] 'solitaire-undo)
                              solitaire-mode-map global-map)  
59    (define-key solitaire-mode-map " " 'solitaire-do-check)    (define-key solitaire-mode-map " " 'solitaire-do-check)
60    (define-key solitaire-mode-map "q" 'quit-window)    (define-key solitaire-mode-map "q" 'quit-window)
61    
# Line 77  Line 76 
76    (define-key solitaire-mode-map [kp-5] 'solitaire-center-point)    (define-key solitaire-mode-map [kp-5] 'solitaire-center-point)
77    
78    (define-key solitaire-mode-map [S-kp-6] 'solitaire-move-right)    (define-key solitaire-mode-map [S-kp-6] 'solitaire-move-right)
79    (define-key solitaire-mode-map [S-kp-4] 'solitaire-move-left)    (define-key solitaire-mode-map [S-kp-4] 'solitaire-move-left)
80    (define-key solitaire-mode-map [S-kp-8] 'solitaire-move-up)      (define-key solitaire-mode-map [S-kp-8] 'solitaire-move-up)
81    (define-key solitaire-mode-map [S-kp-2] 'solitaire-move-down)    (define-key solitaire-mode-map [S-kp-2] 'solitaire-move-down)
82    
83    (define-key solitaire-mode-map [kp-enter] 'solitaire-move)    (define-key solitaire-mode-map [kp-enter] 'solitaire-move)
84    (define-key solitaire-mode-map [kp-0] 'solitaire-undo)    (define-key solitaire-mode-map [kp-0] 'solitaire-undo)
# Line 155  I don't know who invented this game, but Line 154  I don't know who invented this game, but
154  its origin seems to be northern Africa.  Here's how to play:  its origin seems to be northern Africa.  Here's how to play:
155  Initially, the board will look similar to this:  Initially, the board will look similar to this:
156    
157          Le Solitaire                      Le Solitaire
158          ============                      ============
159            
160                  o   o   o                          o   o   o
161            
162                  o   o   o                          o   o   o
163            
164          o   o   o   o   o   o   o          o   o   o   o   o   o   o
165            
166          o   o   o   .   o   o   o          o   o   o   .   o   o   o
167            
168          o   o   o   o   o   o   o          o   o   o   o   o   o   o
169            
170                  o   o   o                          o   o   o
171            
172                  o   o   o                          o   o   o
173    
174  Let's call the o's stones and the .'s holes.  One stone fits into one  Let's call the o's stones and the .'s holes.  One stone fits into one
175  hole.  As you can see, all holes but one are occupied by stones.  The  hole.  As you can see, all holes but one are occupied by stones.  The
# Line 187  which therefore is taken away.  The abov Line 186  which therefore is taken away.  The abov
186    
187  That's all.  Here's the board after two moves:  That's all.  Here's the board after two moves:
188    
189                  o   o   o                          o   o   o
190            
191                  .   o   o                          .   o   o
192            
193          o   o   .   o   o   o   o          o   o   .   o   o   o   o
194            
195          o   .   o   o   o   o   o          o   .   o   o   o   o   o
196            
197          o   o   o   o   o   o   o          o   o   o   o   o   o   o
198            
199                  o   o   o                          o   o   o
200            
201                  o   o   o                  o   o   o
202    
203  Pick your favourite shortcuts:  Pick your favourite shortcuts:
# Line 313  Pick your favourite shortcuts: Line 312  Pick your favourite shortcuts:
312                  (not (eolp))))                  (not (eolp))))
313      (if (or (= 0 (following-char))      (if (or (= 0 (following-char))
314              (= ?\  (following-char))              (= ?\  (following-char))
315              (= ?\n (following-char)))                (= ?\n (following-char)))
316          (goto-char start))))          (goto-char start))))
317    
318  (defun solitaire-center-point ()  (defun solitaire-center-point ()
# Line 355  which a stone will be taken away) and ta Line 354  which a stone will be taken away) and ta
354          (error class)          (error class)
355        (let ((start (car class))        (let ((start (car class))
356              (skip (car (cdr class)))              (skip (car (cdr class)))
357              (target (car (cdr (cdr class)))))                (target (car (cdr (cdr class)))))
358          (goto-char start)          (goto-char start)
359          (delete-char 1)          (delete-char 1)
360          (insert ?.)          (insert ?.)
# Line 386  which a stone will be taken away) and ta Line 385  which a stone will be taken away) and ta
385                     (<= (solitaire-current-line) solitaire-end-y)                     (<= (solitaire-current-line) solitaire-end-y)
386                     (setq count (1+ count))))                     (setq count (1+ count))))
387              count)))              count)))
388    (solitaire-build-modeline)      (solitaire-build-modeline)
389    (if solitaire-auto-eval (solitaire-do-check)))    (if solitaire-auto-eval (solitaire-do-check)))
390    
391  (defun solitaire-check ()  (defun solitaire-check ()

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.10.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26