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

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

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

revision 1.21 by eliz, Tue Oct 25 08:39:34 2005 UTC revision 1.22 by monnier, Tue Oct 25 15:28:00 2005 UTC
# Line 51  Line 51 
51  ;;                 2   H 4       H  ;;                 2   H 4       H
52  ;;  ;;
53  ;; Rays which enter and exit are numbered.  You can see that rays 1 & 5 pass  ;; Rays which enter and exit are numbered.  You can see that rays 1 & 5 pass
54  ;; thru the box undisturbed. Ray 2 is deflected by the northwesternmost  ;; thru the box undisturbed.  Ray 2 is deflected by the northwesternmost
55  ;; ball.  Likewise rays 3 and 4. Rays which hit balls and are absorbed are  ;; ball.  Likewise rays 3 and 4. Rays which hit balls and are absorbed are
56  ;; marked with H.  The bottom of the left and the right of the bottom hit  ;; marked with H.  The bottom of the left and the right of the bottom hit
57  ;; the southeastern ball directly.  Rays may also hit balls after being  ;; the southeastern ball directly.  Rays may also hit balls after being
58  ;; reflected. Consider the H on the bottom next to the 4.  It bounces off  ;; reflected.  Consider the H on the bottom next to the 4.  It bounces off
59  ;; the NW-ern most ball and hits the central ball.  A ray shot from above  ;; the NW-ern most ball and hits the central ball.  A ray shot from above
60  ;; the right side 5 would hit the SE-ern most ball.  The R beneath the 5  ;; the right side 5 would hit the SE-ern most ball.  The R beneath the 5
61  ;; is because the ball is returned instantly.  It is not allowed into  ;; is because the ball is returned instantly.  It is not allowed into
# Line 69  Line 69 
69    
70  ;;; Code:  ;;; Code:
71    
 (defvar blackbox-mode-map nil "")  
   
72  (defvar bb-board nil  (defvar bb-board nil
73    "Blackbox board.")    "Blackbox board.")
74    
# Line 93  Line 91 
91  ;; blackbox-specific bindings in blackbox-mode-map.  This is so that  ;; blackbox-specific bindings in blackbox-mode-map.  This is so that
92  ;; users who prefer non-default key bindings for cursor motion don't  ;; users who prefer non-default key bindings for cursor motion don't
93  ;; lose that when they play Blackbox.  ;; lose that when they play Blackbox.
94  (defun blackbox-redefine-key (oldfun newfun)  (defun blackbox-redefine-key (map oldfun newfun)
95    "Redefine keys that run the function OLDFUN to run NEWFUN instead."    "Redefine keys that run the function OLDFUN to run NEWFUN instead."
96    (define-key blackbox-mode-map (vector 'remap oldfun) newfun))    (define-key map (vector 'remap oldfun) newfun))
97    
98    
99  (unless blackbox-mode-map  (defvar blackbox-mode-map
100    (setq blackbox-mode-map (make-keymap))    (let ((map (make-keymap)))
101    (suppress-keymap blackbox-mode-map t)      (suppress-keymap map t)
102    (blackbox-redefine-key 'backward-char 'bb-left)      (blackbox-redefine-key map 'backward-char 'bb-left)
103    (blackbox-redefine-key 'forward-char 'bb-right)      (blackbox-redefine-key map 'forward-char 'bb-right)
104    (blackbox-redefine-key 'previous-line 'bb-up)      (blackbox-redefine-key map 'previous-line 'bb-up)
105    (blackbox-redefine-key 'next-line 'bb-down)      (blackbox-redefine-key map 'next-line 'bb-down)
106    (blackbox-redefine-key 'move-end-of-line 'bb-eol)      (blackbox-redefine-key map 'move-end-of-line 'bb-eol)
107    (blackbox-redefine-key 'move-beginning-of-line 'bb-bol)      (blackbox-redefine-key map 'move-beginning-of-line 'bb-bol)
108    (define-key blackbox-mode-map " " 'bb-romp)      (define-key map " " 'bb-romp)
109    (define-key blackbox-mode-map [insert] 'bb-romp)      (define-key map [insert] 'bb-romp)
110    (blackbox-redefine-key 'newline 'bb-done))      (blackbox-redefine-key map 'newline 'bb-done)
111        map))
112    
113  ;; Blackbox mode is suitable only for specially formatted data.  ;; Blackbox mode is suitable only for specially formatted data.
114  (put 'blackbox-mode 'mode-class 'special)  (put 'blackbox-mode 'mode-class 'special)
# Line 434  a reflection." Line 434  a reflection."
434    
435  (provide 'blackbox)  (provide 'blackbox)
436    
437  ;;; arch-tag: 6c474c62-5617-4b10-9b44-ac430168c0e2  ;; arch-tag: 6c474c62-5617-4b10-9b44-ac430168c0e2
438  ;;; blackbox.el ends here  ;;; blackbox.el ends here

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

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